question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug(autocomplete): harness does not fire focusin event

See original GitHub issue

Reproduction

Use StackBlitz to reproduce your issue:

Steps to reproduce:

  1. Create an autocomplete test with harness
  2. 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:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
crisbetocommented, Oct 16, 2021

It looks like we have some fallback logic that simulates the focus and blur events manually if the browser doesn’t fire them, but it wasn’t accounting for focusin and focusout. I’ve submitted #23757 to sort it out.

0reactions
angular-automatic-lock-bot[bot]commented, Nov 19, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found