bug(autocomplete): harness does not fire focusin event
See original GitHub issueReproduction
Use StackBlitz to reproduce your issue:
Steps to reproduce:
- Create an autocomplete test with harness
- Focus the autocomplete via
MatAutocompleteHarness.focus()
Expected Behavior
The input element is focused and the autocomplete options are rendered. They can also be queried in the DOM (e.g. check that an element with text “Choice A” exists). Dispatching focus
via a harness should also dispatch focusin
beforehand, so that it emulates properly the browser behavior.
Actual Behavior
The input element is focused, but the options are not open. This is because the autocomplete harness fires the focus
event, while mat-autocomplete-trigger
listens for focusin
events, which are not triggered via the JS focus
event.
Environment
- Angular: 12.2
- CDK/Material: 12.2
- Browser(s): Chrome 96
- Operating System (e.g. Windows, macOS, Ubuntu): Windows
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
autocomplete panel doesn't pop up when triggering focus on ...
The issue actually seems to be that clicking a button to focus the autocomplete triggers an _outsideClickStream event just after it has been ......
Read more >Autocomplete | Angular Material
Event that is emitted whenever an option from the list is selected. id: string. Unique ID to be used by autocomplete trigger's "aria-owns"...
Read more >Angular Material 2 Autocomplete, mat-option element doesn't ...
The click event binding works as expected but the keyup.enter or even just the keyup event doesn't work. Is this a bug in...
Read more >Autocomplete dropdown doesn't close when lost ...
Clicking off the autocomplete to remove focus, the dropdown does not close until the user clicks back into the autocomplete.
Read more >Changelog - Cypress Documentation
Fixed an issue where updating a component would not trigger the supportFile to reload imported stylesheets. This is fixed by doing a full...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It looks like we have some fallback logic that simulates the
focus
andblur
events manually if the browser doesn’t fire them, but it wasn’t accounting forfocusin
andfocusout
. I’ve submitted #23757 to sort it out.This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.