CLOSED DUPLICATE of bug 217240 220580
REGRESSION (r257839): Element cannot be "focus()"ed right after becoming visible from hidden
https://bugs.webkit.org/show_bug.cgi?id=220580
Summary REGRESSION (r257839): Element cannot be "focus()"ed right after becoming visi...
Tomoki Imai
Reported 2021-01-12 23:04:38 PST
Created attachment 417510 [details] Testcase We found a regression from r257839. Here is how to reproduce: 1. Open the attached html with MiniBrowser 2. Push Enter key Expected result: Newly appeared "Menu Item" button should have focus. Actual result: Newly appeared "Menu Item" button doesn't have focus. Reproduced environment: - WinCairo MiniBrowser (r271389) Note: - I confirmed that reverting r257839 solves the issue. - Chrome (87.0.4280.141) and Firefox (84.0.1) on Windows don't have this issue - I didn't test Safari, but because the changed code in r257839 is platform-independent code, I hope it can be reproduced in Safari too. Attached test case description: "Menu Item" button is at first invisible, because the div which contains the button is "display:none". When Enter key is hit, "open" class is added, and it should overwrite "display" with "block". Then we call "focus" on the button. Because button is visible now, it should have focus. // open menu document.querySelector('.menu').classList.add('open'); // focus on menu item document.querySelector('.menu-item').focus(); <div class="menu"> <ul> <li> <button class="menu-item">Menu Item</button> </li> </ul> </div> .menu { display: none; background: #000; } .open { display: block; }
Attachments
Testcase (1.25 KB, text/html)
2021-01-12 23:04 PST, Tomoki Imai
no flags
Antti Koivisto
Comment 1 2021-01-13 05:30:44 PST
I can't repro on Safari (the menu opens fine) but I believe this is the same bug as 217240. *** This bug has been marked as a duplicate of bug 217240 ***
Tomoki Imai
Comment 2 2021-01-13 06:02:40 PST
Antti, Thanks for the info, sorry, I'm not sure why I missed that ticket. This bug and bug bug 217240 seems to be same. I confirmed that attachment 417524 [details] in bug 217240 fixes this issue.
Antti Koivisto
Comment 3 2021-01-14 01:38:51 PST
Thanks for confirmation!
Note You need to log in before you can comment on or make changes to this bug.