After opening the HTMLDialogElement the first click inside of it also focuses the dialog element on Chromium. Basically each first click within the dialog fires the focus event.
Thant is not the case on Firefox.
In my current use case, the focus trap causes problems for me but everything is fine on FF.
Is this an intentional behavior of Chromium?
Why is there a difference?
CHROMIUM BEHAVIOR:
- step 1: press show()
- step 2: click within dialog -> focus event fired
- step 3: click outside dialog and click within dialog again -> focus event fired
- setp 4: close()
- step 5: showModal()
- step 6: click anywhere -> focus event fired
FIREFOX BEHAVIOR:
-
- no focus events fired ever
Stackblitz:
https://stackblitz.com/edit/typescript-s7ajm9?file=index.html,index.ts
I will create a workaround for my current use case and post it here as a solution but the question is if there is a reason to have a different behavior?