Stop Popover from closing if mouse event is prevented #19106
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
xref: https://github.com/github/accessibility-audits/issues/8591
Description
When the 'x' close button in the branch popover dropdown is invoked, the textbox removes the 'x' close button from the DOM. Next, in the popover component handles the click event looking for a click event "Outside the popover" which it checks for by seeing if the target of the click is contained by the popover... which it isn't now that it has been removed.
Thus, I called e.preventDefault() and in that subsequent popover event handling added the check to see if the event had been prevented and if so to ignore it.
Screenshots
CleanShot.2024-08-14.at.11.01.04.mp4
Video shows invoking the clear button via enter key and via clicking and neither closes the popover.
Release notes
Notes: [Fixed] The branch selection popover in the Open a Pull Request Dialog does not close on filter clearing.