Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlight incomplete fields #14

Open
swashbuck opened this issue Oct 17, 2024 · 5 comments
Open

Highlight incomplete fields #14

swashbuck opened this issue Oct 17, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@swashbuck
Copy link
Contributor

swashbuck commented Oct 17, 2024

Subject of the enhancement

Consider highlighting any incomplete fields. Mostly would apply to components with multiple items like Matching and Text Input.

  1. What would the highlight look like? Border, icon, etc.
  2. If using a border, it should always have proper contrast with surrounding elements
  3. Would this be needed for all question components or just Matching where it would be the most useful? If only used with Matching, does this create an inconsistent UI?
@oliverfoster
Copy link
Member

oliverfoster commented Oct 17, 2024

It wonder if we should move the 'has-error` code into core so that the components can implement their own error styling?

Or make matching instructionError aware?

@swashbuck
Copy link
Contributor Author

It wonder if we should move the 'has-error` code into core so that the components can implement their own error styling?

Not a bad idea to move this to core since we already have showInstructionError() there.

Or make matching instructionError aware?

Yep, then the .has-error styles could be specific to Matching's Less and any other question that wants to use it.

@kirsty-hames
Copy link

  1. What would the highlight look like? Border, icon, etc.

Border seems to be the standard. Note, this will need to be compatible with Vanilla buttons PR. The PR uses box-shadow for the application of borders so using border should be fine but raising for awareness.

  1. If using a border, it should always have proper contrast with surrounding elements

Agreed, and this can be handled via the theme.

  1. Would this be needed for all question components or just Matching where it would be the most useful? If only used with Matching, does this create an inconsistent UI?

I think this is most useful for components with multiple questions/entries, as it identifies which of the items require further input. This applies to Matching and Textinput. See below for Textinput example. Please flag if there's other components I've missed.

In addition, if we are going to visually highlight which items require further input then we should do the same programatically? Looking into this, I think aria-invalid would provide this.

Ref: https://www.w3.org/WAI/WCAG21/Techniques/aria/ARIA21
Ref: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-invalid

@swashbuck
Copy link
Contributor Author

It wonder if we should move the 'has-error` code into core so that the components can implement their own error styling?

I've created this PR for the has-error class:
adaptlearning/adapt-contrib-core#595

@swashbuck
Copy link
Contributor Author

  1. What would the highlight look like? Border, icon, etc.

Border seems to be the standard. Note, this will need to be compatible with Vanilla buttons PR. The PR uses box-shadow for the application of borders so using border should be fine but raising for awareness.

@kirsty-hames There's also the possibility of a pseudo-element like a ::before element with a border. This would only work if we never show the error border and an icon (ex. marking) at the same time. Otherwise, we may need to account for the icon width which would be difficult. Since the marking / correctness icons are only shown after submission and a successful submission would remove the error border, I don't believe it would be a problem. That said, I'm totally fine using whatever is the simplest and most compatible method.

  1. Would this be needed for all question components or just Matching where it would be the most useful? If only used with Matching, does this create an inconsistent UI?

I think this is most useful for components with multiple questions/entries, as it identifies which of the items require further input. This applies to Matching and Textinput. See below for Textinput example. Please flag if there's other components I've missed.

Thanks, I always forget that Text Input can have multiple items. I've updated the ticket description above.

In addition, if we are going to visually highlight which items require further input then we should do the same programatically? Looking into this, I think aria-invalid would provide this.

Nice! I think that would work well here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

3 participants