Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change exception thrown when popover attribute is not present #8891

Merged
merged 2 commits into from
Feb 27, 2023

Conversation

josepharhar
Copy link
Contributor

@josepharhar josepharhar commented Feb 16, 2023

This patch changes the exception thrown from InvalidStateError to NotSupportedError when showPopover or hidePopover is called on elements which don't have a popover attribute.

Chrome's implementation does this and I missed it when I initially wrote the spec. The reason that NotSupportedError is thrown instead is that elements wich don't have a popover attribute don't support showPopover and hidePopover, and in the other cases showPopover and hidePopover are supported but something else is in the wrong state, such as the popover already showing when showPopover is called.

This was raised here:
web-platform-tests/wpt#38512

(See WHATWG Working Mode: Changes for more details.)


/popover.html ( diff )

@annevk
Copy link
Member

annevk commented Feb 16, 2023

We discussed these exceptions as part of the popover PR pretty explicitly. I think the status quo is fine here.

cc @nt1m

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed that you had coordinated this with @nt1m already. As I don't feel strongly I've done a quick editorial pass.

source Outdated Show resolved Hide resolved
source Outdated Show resolved Hide resolved
source Outdated Show resolved Hide resolved
@nt1m
Copy link
Member

nt1m commented Feb 16, 2023

@annevk I'd like us to go with whatever exception is more consistent with prior art, whichever that is.

@annevk
Copy link
Member

annevk commented Feb 16, 2023

@nt1m I'm afraid exceptions are all over the map.

@mfreed7
Copy link
Contributor

mfreed7 commented Feb 17, 2023

Just to add my logic for why they're the way they're currently implemented in Chromium (and described in this spec PR):

  • NotSupported seems to make the most sense for calling showPopover() on an element that "isn't a popover" (doesn't wear the popover attribute), so that operation is "not supported".
  • InvalidState makes sense when showPopover() is called on a popover that isn't in the "right state", such as when it is already in the open state.

I'm ok either way really, this just made semantic sense to me.

@annevk
Copy link
Member

annevk commented Feb 23, 2023

I pushed some nits. Let me know what you think.

@mfreed7 did you create a PR to revert the test changes?

@josepharhar
Copy link
Contributor Author

It looks like the changes were already reverted here: web-platform-tests/wpt#38392

@mfreed7
Copy link
Contributor

mfreed7 commented Feb 25, 2023

It looks like the changes were already reverted here: web-platform-tests/wpt#38392

Yep that’s right - I reverted the exception changes as part of that larger PR.

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to assume my nits are okay.

@annevk annevk merged commit 031d3f1 into whatwg:main Feb 27, 2023
@annevk
Copy link
Member

annevk commented Feb 27, 2023

@nt1m do we have a bug to track this or do I/you need to file something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: popover The popover attribute and friends
Development

Successfully merging this pull request may close these issues.

4 participants