Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix bug with keyboard input in click tooltips #18044
Description of the Change
In https://github.com/atom/atom/pull/17651/files, @cacheflow (hi! I think we follow each other on twitter, fancy seeing you here
Unfortunately, this fix led to some unfortunate side effects. Some tooltips (such as Teletype, and the github atom branch creation menu) need keyboard functionality. These tooltips were closing on keypress, so users couldn't actually enter the input. Also,
This fix scopes @cacheflow's original changes to only tooltips that are triggered on hover. The assumption being, hover tooltips are most likely to get in the way. The thinking is, click-triggered tooltips are more likely to be intentionally triggered (and all the input tooltips I'm aware of are click-triggered.) It also attaches/removes the event listeners when a hover tooltip is shown, rather than when the tooltip is registered with the event manager. That's going to cut down on the number of listeners.
I'm a little afraid of the event handling code in atom/atom and tbh didn't really consider any alternatives.
Why Should This Be In Core?
It's a bugfix of existing core functionality.
Teletype and the github atom branch selector work again.
The handling for events in Atom is complicated. It's possible that this fix could trigger undesirable behavior. For example, if there are tooltips that are triggered by a click, that are blocking somewhere where a user wants to type, the user will have to dismiss these tooltips with a click.
@cacheflow yes, it would probably be better to fix the resizing events as well. In case there are side effects, it would probably be good to clean that up separately. I added a comment though, just so people don't add more listeners in