-
Notifications
You must be signed in to change notification settings - Fork 90
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
Upload a file button gets no focus #298
Comments
This is a really good solution |
Hey @trevorsaint, looks like these do have some problems with regards to accessibility and browser support, recommend using the default inputs until we have a fix for this :) Thanks for raising! |
Hi back @NickColley I have it now working in my version and did not require that much work to be honest. Firefox has a little issue with focus but have a JS solution to add a focused class. It works well. Take a peak: http://tfl-prosecutor.herokuapp.com/send-data-files |
Hey @trevorsaint, Looks better but there's still a few issues:
There could be more issues I'm not aware of at the current time, that's why I recommend using the native upload input until we can get something robust that is properly tested. |
Hi @NickColley Yes I know more needs doing :). I think perhaps .js element would be good here so If no-js we would have an alternative being the standard file upload. I will spend some time looking into it also. Thanks Nick. |
Great, working well without JS! 🚀 Just to illustrate why older browser keyboard support is important here... With your current revision IE8 works with a cursor but keyboard access is broken. This is important when you consider the people using JAWs on IE8 (http://webaim.org/projects/screenreadersurvey6/#browsercombos) So you could consider falling back like you have done without JavaScript under IE9, this would fix the issues for anyone using IE6-8 (including screenreader users) If you'd like to contribute to govuk_elements feel free to do a pull request, no worries if not 😄 |
Hi @NickColley I will do just that :). |
We've done something similar on passports renewals for our photo upload. We visually hide the file input and style the label as a button and set DAC (Digital Accessibility Centre) have tested it and it was mostly fine, apart from with older versions of Dragon Naturally Speaking that don't understand the button role. If memory serves, I think JAWS may read out two file inputs but this is partly to do with the way IE handles the input and filename in the first place. We auto-submit the form once a file has been selected (so don't need to show the filename). This has tested well with our users. It's working in IE8 and above, for older browsers we show show the defaults. Have a look at https://www.passport.service.gov.uk/photo/upload (you will get thrown back to the start of the journey but it's only about five pages in). |
For now, we're going to revert what we have back to the native controls (as @NickColley mentioned above), until there's time to find a better custom solution. Also thanks @trevorsaint for spotting this! |
4.15.0 alphagov/govuk_frontend_toolkit@620c7fdb1eca75 cfb7a8c076cafcf50852a85008 Add support for Google Analytics fieldsObject (PR #298) anchor-buttons.js: normalise keyboard behaviour between buttons and links with a button role (PR #297)
How would you expect it to work?
I would expect the button to receive tabbed focus and a yellow border appear like all other form elements. The enter key or space bar may open up the file selection dialog.
How does it work currently?
Skips tabbed focus completely.
Feel free to suggest a fix...
Use javascript to set a focussed class on the button wrapper when the hidden input has focus.
Because the input is using display: none we won't be able to get focus so perhaps using opacity: 0 may work, or text-indent: -999px. I have not tried any of these approaches yet.
Explain the steps to reproduce the bug
Tabbing through the DOM.
Tell us about your environment
Latest version
Firefox 48.0.1
Mac OSX El Captain
http://tfl-prosecutor.herokuapp.com/send-data-files
The text was updated successfully, but these errors were encountered: