这是indexloc提供的服务,不要输入任何密码
Skip to content

[BUG] Polyfill not working in React #283

@erikblomqvist-huma

Description

@erikblomqvist-huma

Describe the bug
When trying to use the polyfill in a React app, the variable names (CSS properties) used for anchoring and positioning the target gets rendered in the DOM (added to the anchor and target elements), but the actual values are incorrect, and the references that are supposed to be added to html element aren't rendered, causing the polyfill to not work as intended.

I've also tried calling the polyfill() like this in App.js:

const anchorRef = useRef();
const targetRef = useRef();

useEffect(() => {
  if(!anchorRef.current || !targetRef.current) {
    return null
  }

  polyfill({ elements: [anchorRef.current, targetRef.current] })
}, [anchorRef, targetRef])

… but that doesn't trigger any of the polyfills.

To Reproduce
CodeSandbox

Screenshots
image

Browsers tested on

  • macOS Sequoia 15.0.1
    • Safari 18.0.1
    • Firefox 133.0.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions