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
togglePopover() algorithm does not check popover validity when force == false and when the popover visibility state is hidden #8999
Are you saying that when togglePopover decides not to do anything, we should still call check popover validity...? I don't see why we should.
There is this slight oddity when you call togglePopover(false) on an element with no popover attribute and it ends up doing nothing instead of throwing an exception. Seems like a bad developer experience, though not something I feel too strongly about.
We decided to not throw in certain cases. Did we decide to not throw for cases where state does not match up? It looks to me like showPopover() still throws for this condition so togglePopover() should as well.
So the following code would result in a call to check popover validity and possibly throw exceptions?
constdiv=document.createElement('div');div.setAttribute('popover','auto');// don't connect to document or showdiv.togglePopover(/*force=*/false);// try to force close
We decided to not throw in certain cases. Did we decide to not throw for cases where state does not match up? It looks to me like showPopover() still throws for this condition so togglePopover() should as well.
So the above code I wrote should throw an exception then?
So the following code would result in a call to check popover validity and possibly throw exceptions?
constdiv=document.createElement('div');div.setAttribute('popover','auto');// don't connect to document or showdiv.togglePopover(/*force=*/false);// try to force close
We decided to not throw in certain cases. Did we decide to not throw for cases where state does not match up? It looks to me like showPopover() still throws for this condition so togglePopover() should as well.
So the above code I wrote should throw an exception then?
@josepharhar Since hidePopover() wouldn't throw in this case, I would say it shouldn't (and in fact it wouldn't with the suggested change, since the check popover validity algorithm wouldn't in this case).
But:
constdiv=document.createElement('div');// don't set popover attribute// don't connect to document or showdiv.togglePopover(/*force=*/false);// try to force close
would start throwing, unlike the current algorithm.
Stuff in step 3. of the check popover validity would also start throwing.
Activity
nt1m commentedon Mar 9, 2023
Probably doesn't matter too much fwiw.
mfreed7 commentedon Mar 13, 2023
Seems like an oversight to me also, but I'll let @josepharhar comment.
josepharhar commentedon Mar 13, 2023
togglePopover just calls "hide a popover" or "show popover", and each of those algorithms check popover validity as their first step.
Are you saying that when togglePopover decides not to do anything, we should still call check popover validity...? I don't see why we should.
nt1m commentedon Mar 14, 2023
There is this slight oddity when you call
togglePopover(false)on an element with no popover attribute and it ends up doing nothing instead of throwing an exception. Seems like a bad developer experience, though not something I feel too strongly about.annevk commentedon Mar 16, 2023
What if we make the logic:
nt1m commentedon Jun 6, 2023
@annevk Do you think it's still worth changing the spec given the recent changes to not throw?
The implication of this change is that the other "check popover validity" checks (dialog, fullscreen, disconnected) would run in the cases I mentioned in the title: https://html.spec.whatwg.org/multipage/popover.html#check-popover-validity
annevk commentedon Jun 6, 2023
We decided to not throw in certain cases. Did we decide to not throw for cases where state does not match up? It looks to me like
showPopover()still throws for this condition sotogglePopover()should as well.josepharhar commentedon Jun 7, 2023
So the following code would result in a call to check popover validity and possibly throw exceptions?
So the above code I wrote should throw an exception then?
nt1m commentedon Jun 8, 2023
@josepharhar Since hidePopover() wouldn't throw in this case, I would say it shouldn't (and in fact it wouldn't with the suggested change, since the
check popover validityalgorithm wouldn't in this case).But:
would start throwing, unlike the current algorithm.
Stuff in step 3. of the check popover validity would also start throwing.
Make togglePopover throw more exceptions
Make togglePopover throw more exceptions
Make togglePopover throw more exceptions
josepharhar commentedon Jun 21, 2023
Ok, I created a PR to implement this: #9451
rwlbuis commentedon Jun 27, 2023
I have a similar PR for WebKit:
WebKit/WebKit#15333
Make togglePopover() throw more exceptions
[popover] Make togglePopover throw more exceptions
Make togglePopover throw more exceptions
Make togglePopover throw more exceptions
Make togglePopover throw more exceptions
Bug 1839745 [wpt PR 40682] - Make togglePopover throw more exceptions…
Bug 1839745 [wpt PR 40682] - Make togglePopover throw more exceptions…
Bug 1839745 [wpt PR 40682] - Make togglePopover throw more exceptions…
Bug 1839745 [wpt PR 40682] - Make togglePopover throw more exceptions…
[popover] Make togglePopover throw more exceptions
Make togglePopover() throw more exceptions
Make togglePopover() throw more exceptions
Bug 1839745 [wpt PR 40682] - Make togglePopover throw more exceptions…