oddbird / popover-polyfill

Polyfills the HTML popover attribute and showPopover/hidePopover/togglePopover methods onto HTMLElement, as well as the popovertarget and popovertargetaction attributes on <button> elements.
https://popover.oddbird.net
BSD 3-Clause "New" or "Revised" License
269 stars 14 forks source link

Is there a way to FORCE use of the polyfill on Safari 17? #212

Closed williamsdyyz closed 4 months ago

williamsdyyz commented 5 months ago

I ask because the Safari implementation is buggy and the polyfill works better!

jgerigmeyer commented 5 months ago

I haven't tested it, but if you have a way to determine whether your code is running in Safari 17 (or a way to identify a particular "bugginess"), I think you could import the apply method directly and skip the isSupported check:

import { apply, isSupported } from '@oddbird/popover-polyfill/fn';

if (isSafari17 || !isSupported()) {
  apply();
}
williamsdyyz commented 5 months ago

Interesting idea. I'll see what happens. Thanks