Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In short answer questions, hitting enter seems to go to the previous question.
Any thoughts on how to fix?
Thank you!
Comment | File | Size | Author |
---|---|---|---|
#18 | hitting_enter_goes_to-1659400-18.patch | 917 bytes | djdevin |
|
Comments
Comment #1
michaelk CreditAttribution: michaelk commentedI am also running into this issue. Has anyone found a solution?
Comment #2
michaelk CreditAttribution: michaelk commentedI was able to track down the cause of this issue and specific steps to reproduce it.
Steps to Reproduce:
There are essentially 2 issues here:
You can read more about all of these issues and various workarounds in these articles:
I have attached a patch which addresses both of these issues in a way that works for all browsers (tested in IE, Chrome, Safari, and Firefox) and does not require javascript to work. Essentially it just introduces a hidden submit button before all of the other navigation controls, so it is always the default. Also, it adds a hidden form element to detect the case of the form being submitted with the Enter key in IE 7 and 8.
Comment #3
tasetta CreditAttribution: tasetta commentedAwesome, I was just looking for this. I have never done a patch before however, could you tell me how I apply it?
Comment #4
michaelk CreditAttribution: michaelk commentedSee https://drupal.org/patch/apply
Comment #5
Sivaji_Ganesh_Jojodae CreditAttribution: Sivaji_Ganesh_Jojodae commented@michaelk,
I'm not sure if an additional hidden field is needed for this.
Is it not possible to fix this by changing the weight of existing buttons in answering form (by placing them in order Submit, Back and Skip) and with CSS we could again make them appear in the same order as it is now. I remember fixing this in one of the client projects. I will see if i can get the fix.
Comment #6
michaelk CreditAttribution: michaelk commented@sivaji
I looked into doing it with CSS first as it would have been cleaner, but I wasn't able to come up with CSS that positioned the buttons nicely in all of the different cases (with and without Back and Skip buttons).
Also, changing the order of the buttons will not address the issue with IE 7 and 8 where submitting the form using Enter does not even include a button value in POST and thus it doesn't navigate forward or backward.
Comment #7
mikran CreditAttribution: mikran commentedThis is committed in d01f8b49 so marking as fixed altough it broke custom #validate functions from answering forms. Opening a new follow-up (#2216267: Custom form validate functions stopped working as a result of 'press Enter fix'.) with that.
Comment #13
fuzzy76 CreditAttribution: fuzzy76 commentedThis is happening in 7.x-5.x and I cannot find the code from the patch anywhere in the module.
Comment #14
fuzzy76 CreditAttribution: fuzzy76 commentedAny chance of getting this in?
Comment #15
djdevinComment #16
djdevinPatch doesn't port at all, also since more browsers are now unsupported it might be a different approach.
Comment #17
fuzzy76 CreditAttribution: fuzzy76 commentedFWIW, this prevents any site running Quiz from being WCAG compatible.
Comment #18
djdevinThis might work?
Comment #20
djdevinI tested this in FF and Chrome and was able to submit a short answer question by typing it in and then pressing enter.