#20880 closed defect (bug) (fixed)
Keyboard navigation in Appearance > Header is broken
Reported by: | kovshenin | Owned by: | johnbillion |
---|---|---|---|
Milestone: | 4.1 | Priority: | normal |
Severity: | normal | Version: | 3.3.2 |
Component: | Customize | Keywords: | |
Focuses: | accessibility | Cc: |
Description
It's impossible to use the Appearance > Header section with the keyboard because the Enter button will submit the form using the top-most submit input, which is not always the Save Changes button. How to reproduce, in Appearance > Header, using Twenty Eleven:
- Select one of the default header images
- Check the Show header text with your image option
- Enter #111 for Text Color
- Click Save Changes
At this point everything looks fine, but here comes the trouble:
- Enter #222 for Text Color and hit Enter
You'll notice that #222 hasn't been set as the Text Color, instead your chosen header image (in step 1) has been removed, as if the Remove Header Image button was clicked.
- Enter #333 for Text Color and hit Enter
You'll notice that #333 hasn't been set as the Text Color, instead it's been set to #000 which is Twenty Eleven's default, as if the Restore Original Header Text button was clicked.
When both Remove Header Image and Restore Original Header Text buttons are not present, the Return key submits the form using Save Changes, as expected. It's not limited to Text Color, but any other element that can submit the form using the Enter key.
I've been facing the exact same problem when doing an options panel for a theme with multiple actions as submit buttons, still haven't found a good solution. Marked as 3.3.2 but I believe it's been around earlier.
Thanks!
Attachments (3)
Change History (11)
#2
follow-up:
↓ 3
@
13 years ago
@azaozz Thanks for the feedback. The first method seems very clean and straightforward, I guess it can work for this particular situation, I'll draft a patch. However, if the form is a little more complex than what we have in Appearance > Header, we might have to use the second one, or maybe just use separate forms (a third one?). I wish browsers looked at the tabindex
property when choosing which submit button to use.
@
13 years ago
Adding a hidden submit button before anything else in the form, thanks for the tip @azaozz
#3
in reply to:
↑ 2
@
13 years ago
- Component changed from Appearance to Accessibility
Replying to kovshenin:
...I wish browsers looked at the
tabindex
property when choosing which submit button to use.
That is logical but don't think it would happen :) Some versions of Safari even completely ignore tabindex
.
As this is an accessibility "hidden" element, perhaps we would need to use something like .screen-reader-text to hide it, visibility: hidden
still affects the box model (margins, padding, etc.).
#4
@
13 years ago
Thanks @azaozz, my initial thought was that .screen-reader-text
did display: none;
, which not only hides the button, but renders it unusable too. However, screen-reader-text
seems way smarter than that :)
Generally there are two ways to fix this:
<input type=submit />
in the form, usually right after the opening <form> tag. Advantage is that it would work without JS too.