You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The menu can't be dismissed when the mathfield has a transformed ancestor, or by a click on the mathfield #3111
Once the menu of a mathfield is open, a click outside of it should close it. In two cases the menu stays open until an item is chosen:
The mathfield has an ancestor with transform, filter, mask-image, clip-path or contain: paint. These are common: scroll fades use mask-image, and animated cards use transform. A click outside of that ancestor leaves the menu open. The click also moves the focus out of the menu, so Escape no longer closes it either.
The click lands on the mathfield itself, including a second click on the menu toggle. This happens on a plain page, with no such ancestor.
Steps to Reproduce
<!doctype html><html><bodystyle="margin: 40px; font: 20px sans-serif"><p>Text above</p><!-- Any of these on an ancestor reproduces case 1: transform, filter, mask-image, clip-path, contain: paint --><divstyle="transform: translateZ(0)"><math-fieldstyle="width: 300px">x^2+1</math-field></div><p>Text below the field</p><scripttype="module" src="https://unpkg.com/mathlive@0.111.1/mathlive.min.mjs"></script></body></html>
Click the menu toggle. The menu opens.
Click "Text below the field".
Press Escape.
Remove the transform, reload, and repeat steps 1 and 2.
With or without the transform, open the menu, then click the text of the mathfield, or the menu toggle again.
Actual Behavior
Step 2: the menu stays open.
Step 3: the menu stays open, because the click in step 2 moved the focus to the page.
Step 4: the menu closes, so the transform is what keeps it open in step 2.
Step 5: the menu stays open.
Each cell below opens the menu with the toggle, then makes one click. The last column presses Escape after a click outside.
Ancestor style
Click outside
Click on the mathfield
Toggle again
Escape after a click outside
none
closes
stays open
stays open
(already closed)
overflow: hidden
closes
stays open
stays open
(already closed)
transform: translateZ(0)
stays open
stays open
stays open
stays open
filter: blur(0)
stays open
stays open
stays open
stays open
contain: paint
stays open
stays open
stays open
stays open
clip-path: inset(0)
stays open
stays open
stays open
stays open
mask-image
stays open (closes in Safari)
stays open
stays open
stays open (closes in Safari)
Expected Behavior
Any click outside of the menu closes it, whatever the ancestors of the mathfield. A click on the mathfield closes it, and so does a second click on the menu toggle.
Browser Chrome, Firefox and Safari (the Chromium, Firefox and WebKit builds of Playwright 1.63). All three behave as in the table, except that WebKit does not clip clicks with mask-image.
Activity
fix: close the menu on any press outside it