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

Hiding default radio buttons precents browser error messages #38

Open
symroe opened this issue Jan 12, 2022 · 1 comment
Open

Hiding default radio buttons precents browser error messages #38

symroe opened this issue Jan 12, 2022 · 1 comment

Comments

@symroe
Copy link
Member

symroe commented Jan 12, 2022

For a minimal example without the design system:

<form>
  <input type="radio" name="foo" value="1" required>
  <input type="radio" name="foo" value="2" required>
  <button type="submit">submit</button>
</form>

Without selecting either option, when submitting the browser shows an error message.

Adding the below, as we do in the design system, prevents the browser from showing this message

input[type="radio"] {
  visibility: hidden;
}

I _think _ this is because the browser is attaching the message to a pseudo-element of the inputs, and inheriting the visibility.

Changing this to opacity: 0; does show the in-browser error message.

@Heydon I'm not expecting you to dive in and fix this at all, but I thought you might be interested in the bug report.

Tested on Firefox developer edition (96.0b10) on Ubuntu 20.04.

@symroe
Copy link
Member Author

symroe commented Jan 12, 2022

GOV.UK use opacity on their design system:

https://govuk-elements.herokuapp.com/form-elements/example-radios-checkboxes/

I'd like to know more about what this means for accessibility though. I'm going to assume Heydon picked visibility for a reason.

symroe added a commit to DemocracyClub/UK-Polling-Stations that referenced this issue Jan 12, 2022
symroe added a commit to DemocracyClub/UK-Polling-Stations that referenced this issue Jan 13, 2022
GeoWill pushed a commit to GeoWill/UK-Polling-Stations that referenced this issue Jan 31, 2022
VirginiaDooley pushed a commit to DemocracyClub/UK-Polling-Stations that referenced this issue Feb 7, 2022
GeoWill pushed a commit to DemocracyClub/UK-Polling-Stations that referenced this issue Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant