I was told to raise this issue after posting this issue against Field group module (see #1357896: Focus jumps to horizontal tab when pressing enter on a form element).

The issue is that on pressing enter on a form element (e.g. an box) that is inside a horizontal tab, focus jumps to the tab title. I realise this may improve accessibility slightly, but it stops other things happening that should - for example, autocomplete boxes are unusable and the form can't be submitted that way.

My suggested solution for Field group module was simply to avoid moving focus if enter was pressed on an <input> element (they already implemented this for <textarea> elements anyway), but if core is leading the way on this, then it sounds like a discussion should be had here.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Everett Zufelt’s picture

Component: forms system » javascript
Issue tags: +Accessibility

See #1357896: Focus jumps to horizontal tab when pressing enter on a form element

I don't recall the reasoning behind adding this to vertical tabs, the issue is at #467296-93: Accessibility improvements for vertical tabs , I recommend starting at comment #93.

Jacine’s picture

I'd also like to see this adressed. I ran into this issue the other day creating a jQuery plugin to make form descriptions into tooltips.

My issue is with an <a> element. I couldn't unbind the current behavior, so wasn't able to get the script working properly using keyboard for navigation, which is kinda sad... Accessibility "improvements" are blocking me from writing an accessible script.

I hope there is a better way to handle this.

Owen Barton’s picture

This totally bit me on Drupal 7 the other day, using the "chosen" module (fancy multi-select boxes), with field_group module.

Everett Zufelt’s picture

From the 2011-12-13 a11y call, it was decided by consensus that we can likely remove this functionality, provided that the patch is properly tested by AT and keyboard only users.

Speaking as a screen-reader user who interacts with Drupal all day long, I have never used the functionality.

Owen Barton’s picture

Status: Active » Needs review
FileSize
717 bytes

Here is a patch that implements #4. In my tests pressing enter when focus is on a form element (other than a form element that traps the enter key) now submits the form, which I think is expected/normal behavior. Autocomplete dropdowns and textareas trapped returns as they should, without submitting the form.

Status: Needs review » Needs work

The last submitted patch, 1361218.patch, failed testing.

Owen Barton’s picture

FileSize
737 bytes
Owen Barton’s picture

Status: Needs work » Needs review
Bojhan’s picture

works here, RTBC?

nod_’s picture

Status: Needs review » Reviewed & tested by the community

Tested and works here too :)

Everett Zufelt’s picture

+1 on RTBC. I'd like to see this backported to D7 after being committed to D8.

Bojhan’s picture

Issue tags: +Needs backport to D7

backport tag

mgifford’s picture

#7: 1361218.patch queued for re-testing.

catch’s picture

Version: 8.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)
Issue tags: +Novice

Committed/pushed to 8.x, thanks! Moving to 7.x for backport. Barely needs a re-roll so tagging novice for that.

Kevin Morse’s picture

Status: Patch (to be ported) » Needs review
FileSize
717 bytes

This should do it!

oriol_e9g’s picture

Status: Needs review » Reviewed & tested by the community

Same for D7!

webchick’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: +7.13 release notes

Interesting. This code originally came in via #467296: Accessibility improvements for vertical tabs . I guess we made it a little too accessible. :D

Committed and pushed to 7.x. Tagging as something to mention in the 7.13 release notes.

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Fixed issue link