NEW 281209
Focus lost for after closing file input menu
https://bugs.webkit.org/show_bug.cgi?id=281209
Summary Focus lost for after closing file input menu
Gilad Bar
Reported 2024-10-10 01:45:22 PDT
Created attachment 472893 [details] A codepen displaying the issue After closing the file input menu - focus isn't restored to the previous element in the screen. Furthermore - even if focus is restored manually, the browser "steals" the focus and moves it to another random element. This is bad for screen reader users that rely on the focus order. This doesn't happen in Android Chrome. Steps to reproduce (codepen example - https://codepen.io/giladbar6/pen/XWwvOEr) - Use voiceover on iPhone to reproduce - Create custom button that triggers a click on a file input - At this point, focus is on the custom button - The file input menu opens - close it (the menu has an invisible control to close which is accessible with a screen reader) - Manually restore the focus to the custom button - Notice: focus is thrown away to a different element Note: this is a codepen repro but actually happens in my app as well
Attachments
A codepen displaying the issue (541.33 KB, video/mp4)
2024-10-10 01:45 PDT, Gilad Bar
no flags
Radar WebKit Bug Importer
Comment 1 2024-10-10 01:45:31 PDT
Aditya Keerthi
Comment 2 2024-10-10 15:41:09 PDT
My initial guess is that the cause of this is due to how the focused element is tied to form control presentation on iOS. Is the "random element" the file input, or something else entirely?
Gilad Bar
Comment 3 2024-10-10 16:11:39 PDT
(In reply to Aditya Keerthi from comment #2) > My initial guess is that the cause of this is due to how the focused element > is tied to form control presentation on iOS. > > Is the "random element" the file input, or something else entirely? It seems to always focus on the first focusable element in the DOM
Gilad Bar
Comment 4 2024-10-10 16:12:11 PDT
(In reply to Aditya Keerthi from comment #2) > My initial guess is that the cause of this is due to how the focused element > is tied to form control presentation on iOS. > > Is the "random element" the file input, or something else entirely? It seems to always focus on the first focusable element in the DOM
Karl Dubost
Comment 5 2024-11-06 19:26:10 PST
So the request would be: Restore focus to the latest focused element after using the file input menu (or probably any form OS picker)
Note You need to log in before you can comment on or make changes to this bug.