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
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:
Thanks for reporting! It looks like you were almost there with useEffect!
A few things-
When calling the polyfill in index.js, the elements were not yet in the DOM, so the polyfill couldn't find them. Dynamic elements are not yet supported, see applying the polyfill to dynamic elements #91
In your useEffect example, you passed in the target and anchor as elements. This would work if you either also pass in the <style> or <link> element that contain your anchor styles, use inline styles, or omit the elements argument.
In the screenshot of dev tools, it shows the polyfill working as expected. The polyfill doesn't make the browser understand the style rules, but instead adds custom properties in order to implement anchor positioning.
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 inApp.js
:… but that doesn't trigger any of the polyfills.
To Reproduce
CodeSandbox
Screenshots
![image](https://private-user-images.githubusercontent.com/62985223/396939311-3a06f8b1-b3e1-4dae-8b45-b30efcbea33f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0NjI2MjcsIm5iZiI6MTczOTQ2MjMyNywicGF0aCI6Ii82Mjk4NTIyMy8zOTY5MzkzMTEtM2EwNmY4YjEtYjNlMS00ZGFlLThiNDUtYjMwZWZjYmVhMzNmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDE1NTg0N1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE3ZjM0M2VjNGZiY2RhNjYwODI4N2JjYWFlYzQ2NGEwYTgxZmM2YWFkMjcyZTVkODc3MjM3MDI0ODA5OTQxNGMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.VXdBT_J3QBjJxpGAkuNJquL_gORQQbwvYY7sYeP929E)
Browsers tested on
The text was updated successfully, but these errors were encountered: