Repository navigation
Conversation
|
I see Visual, Snapshot and Webkit tests are failing -> will check on those tomorrow |
…bo-box-clicking-toggle-button-doesnt-focus-field
- turned out that selected-focused-chip.png was affected too and the screenshot made it to remote - updated the screenshot so really only the chip focus is tested
web-padawan
left a comment
There was a problem hiding this comment.
Thanks for such a detailed PR description and meaningful commits! 💯
Added a few small comments, otherwise the fix LGTM.
Co-authored-by: Serhii Kulykov <iamkulykov@gmail.com>
DiegoCardoso
left a comment
There was a problem hiding this comment.
LGTM, although I was trying to understand why the selected-focused-chip visual test lost the focus ring.
When you run only the The change I made in That sort of fixed how the |
|
Kudos, SonarCloud Quality Gate passed!
|
|
Hi @bwajtr , this commit cannot be picked to 24.0 by this bot, can you take a look and pick it manually? |
|
Hi @bwajtr , this commit cannot be picked to 23.3 by this bot, can you take a look and pick it manually? |
(cherry picked from commit 99a497e)
(cherry picked from commit 99a497e)
|
This ticket/PR has been released with Vaadin 24.2.0.alpha1 and is also targeting the upcoming stable 24.2.0 version. |








Description
When a
vaadin-combo-boxtoggle button is clicked with a mouse, then the overlay is opened and the internal input field receives focus. For the other "combobox-like" components only the overlay is opened, but the input field of the component does not get the focus. In fact the focus is not changed at all. See this comment for a list of affected components and a test page where it can be easily reproduced.I've hunted down the problem to the
vaadin-combo-box-mixin.js -> _openedChanged()method, where the focus is handled. There is a call tothis.focus()which should change the focus to the internal input. However, this line does not work for the affected components: because it seems thatthisin that context does not refer to an element that would delegate the focus to the internal input (like for the basicvaadin-combo-box).I was thinking about fixing this somehow using the
DelegateFocusMixin, however, I believe that a simpler fix is the one that I came up with in this PR. I think that we can focus directly thethis.inputElementin that part of the code, instead of relying on the delegation of the focus. The other parts of the code speak in favor of such solution: for example methods_onOverlayTouchAction()or__onClearButtonMouseDown()also work directly with a focus ofthis.inputElement.The change caused a lot of changes in the tests, because the focus started to work correctly in some of the scenarios:
packages/combo-box/test/combo-box-light.test.js,packages/multi-select-combo-box/test/basic.test.js,packages/time-picker/test/time-picker.test.jspackages/multi-select-combo-box/test/dom/__snapshots__/multi-select-combo-box.test.snap.js,packages/time-picker/test/dom/__snapshots__/time-picker.test.snap.jspackages/multi-select-combo-box/test/visual/common.jspackages/multi-select-combo-box/test/visual/lumo/multi-select-combo-box.test.js,packages/multi-select-combo-box/test/visual/material/multi-select-combo-box.test.js,packages/time-picker/test/visual/lumo/time-picker.test.js,packages/time-picker/test/visual/material/time-picker.test.jsfocus-utils.js -> isKeyboardActivetotrue. This affects how afocus-ringis rendered in the other tests - it is rendered even in tests where we would not expect it and where focus-ring wouldn't be rendered if test is executed alone. So I'm using one mouse click in the browser to resetfocus-utils.js -> isKeyboardActiveback tofalseFixes #5860
Type of change
Checklist