-
Notifications
You must be signed in to change notification settings - Fork 6.8k
bug(autocomplete): harness does not fire focusin event #23757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It seems like |
Indeed you are right. I am struggling to create a proper harness Stackblitz with the proper angular version though, so that Ivy is enabled. I will be back with a better reproduction. Is it possible that jasmine does not emulate that behavior? |
There's a checkbox in the Stackblitz settings to enable Ivy, but I don't think that's the issue since we're basically interacting directly with the browser APIs. We've seen similar issues like yours in some of our tests and they ended up being caused by the browser not moving focus if the browser window is blurred/minimized. |
Great tip! Indeed it was an issue of the browser running in the background. I have leaving the browser in the front and the test passed. I also tried with ChromeHeadless and it also worked! |
It looks like we have some fallback logic that simulates the |
Fixes that our fake fallback focus events weren't dispatching `focusin` and `focusout` events as well. Fixes angular#23757.
Fixes that our fake fallback focus events weren't dispatching `focusin` and `focusout` events as well. Fixes #23757.
Fixes that our fake fallback focus events weren't dispatching `focusin` and `focusout` events as well. Fixes angular#23757.
Fixes that our fake fallback focus events weren't dispatching `focusin` and `focusout` events as well. Fixes angular#23757.
Fixes that our fake fallback focus events weren't dispatching `focusin` and `focusout` events as well. Fixes angular#23757.
Fixes that our fake fallback focus events weren't dispatching `focusin` and `focusout` events as well. Fixes angular#23757.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Fixes that our fake fallback focus events weren't dispatching `focusin` and `focusout` events as well. Fixes angular#23757.
Fixes that our fake fallback focus events weren't dispatching `focusin` and `focusout` events as well. Fixes angular#23757.
Fixes that our fake fallback focus events weren't dispatching `focusin` and `focusout` events as well. Fixes angular#23757.
Fixes that our fake fallback focus events weren't dispatching `focusin` and `focusout` events as well. Fixes angular#23757.
Uh oh!
There was an error while loading. Please reload this page.
Reproduction
Use StackBlitz to reproduce your issue:
Steps to reproduce:
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 dispatchfocusin
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, whilemat-autocomplete-trigger
listens forfocusin
events, which are not triggered via the JSfocus
event.Environment
The text was updated successfully, but these errors were encountered: