Skip to content
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

Fix intermittent RichTextMentionListbox test #1928

Merged
merged 4 commits into from
Mar 18, 2024

Conversation

m-akinc
Copy link
Contributor

@m-akinc m-akinc commented Mar 13, 2024

Pull Request

🀨 Rationale

Fixes #1891

πŸ‘©β€πŸ’» Implementation

Calling show() on the RichTextMentionListbox results in its anchored region becoming un-hidden, and an intersection observer begins observing the new anchor element (i.e. what the anchored region is attached to). The observer closes the listbox when the anchor element is scrolled out of view. Depending on the timing, the observer callback can run right after calling show(), and if the anchor element is not fully visible in the viewport, then the listbox can be closed before we get a chance to run the rest of the test. Previously, the test had been using the document element as the anchor element, but for some reason that I couldn't discern, the intersection observer would say it was not intersecting (with itself!). I changed the test to use a div (which stays fully in the viewport) as the anchor element, and we no longer run into an issue with the intersection observer prematurely closing the listbox.

πŸ§ͺ Testing

Interestingly, focusing the intermittent test with fit would cause it to always succeed. I had to disable all other tests (with xdescribe) to run the flaky test by itself. I ran the test with my changes many times without any failures.

βœ… Checklist

  • I have updated the project documentation to reflect my changes or determined no changes are needed.

@m-akinc
Copy link
Contributor Author

m-akinc commented Mar 13, 2024

@mollykreis could you please buddy this for me?

@m-akinc m-akinc requested a review from mollykreis March 13, 2024 01:42
@m-akinc m-akinc marked this pull request as ready for review March 13, 2024 23:48
@rajsite rajsite enabled auto-merge (squash) March 18, 2024 17:36
@rajsite rajsite merged commit ca82017 into main Mar 18, 2024
10 checks passed
@rajsite rajsite deleted the users/makinc/intermittent-test-fix branch March 18, 2024 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Intermittent test: mention-listbox "should scroll the selected option into view when opened"
4 participants