alt-text-org / my.alt-text.org

A set of tools for alt text users and writers
GNU General Public License v3.0
35 stars 7 forks source link

Help screen popup closes if you click anywhere #37

Open gsuberland opened 11 months ago

gsuberland commented 11 months ago

Describe the bug If you open the help screen from the menu, then click anywhere, the help screen closes.

The current behaviour makes it impossible to select text on the help page, either for copy/paste or for other use-cases of text highlighting like tracking your reading position.

To Reproduce Steps to reproduce the behaviour:

  1. Open the dropdown menu.
  2. Click on 'help'.
  3. Click anywhere on the screen, including the help popup itself.
  4. The popup will close when you release your mouse button.

Expected behaviour I would expect that the help screen would only close when clicking on the 'Close' button, or outside the bounds of the help screen.

Environment: Tested on Chrome 115.0.5790.170 and Firefox 116.0.2, both on a Windows 10 desktop.

Additional context

The relevant code is:

https://github.com/alt-text-org/my.alt-text.org/blob/aeb3cc100e5d409fe235956a7d1bd0e2ba1f88a2/src/core.js#L78-L80

This sets the click event callback for the dialog itself, rather than the close button within the dialog. The close button itself does not have a click event handler at all, so when you click the button the event bubbles up to the parent dialog element. I suspect this was a case of mistakenly applying the close callback to the dialog element rather than the button element.