Bug 1729741 Comment 8 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

I'm having issues in figuring out how to solve this. These are my findings:

- The `focusout` listener attached to the entire recipients area doesn't play well with native macos context menus as it steals the focus and causes the code to run.
- The fact that the event listener is attached to the entire recipient area and we let it bubble up is not ideal.

Possible solutions/approaches to fix this:
- Force the native macos context menus to not steal the focus if the original target is a pill (not sure if it's doable and if it could affect the keyboard navigation of the context menu items).
- Drop the `focusout` and handle `blur` events to the elements we need to listen to (recipients area, input fields, pills) to avoid bubbling and preventing deselection with more fine tuning.

Maybe a smarter approach that is escaping me right now.
I'm having issues in figuring out how to solve this. These are my findings:

- The `focusout` listener attached to the entire recipients area doesn't play well with native macos context menus as they steal the focus and causes the pill deselection code to run.
- The fact that the event listener is attached to the entire recipient area and we let it bubble up to all its child elements is not ideal as it doesn't leave us much flexibility to handle these edge cases.

Possible solutions/approaches to fix this:
- Force the native macos context menus to not steal the focus if the original target is a pill (not sure if it's doable and if it could affect the keyboard navigation of the context menu items).
- Drop the `focusout` and handle `blur` events to the elements we need to listen to (recipients area, input fields, pills) to avoid bubbling and preventing deselection with more fine tuning.

Maybe a smarter approach that is escaping me right now.

Back to Bug 1729741 Comment 8