0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-08-06 08:57:38 +00:00

fix oddbird polyfill so custom properties are used correctly

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
Gazook89
2026-04-25 22:16:25 -05:00
parent 359d87440b
commit d686c78fdf
2 changed files with 6 additions and 3 deletions
+5 -3
View File
@@ -28,13 +28,14 @@ const Dropdown = ({ groupName, className = null, icon, children, color = null, c
const isSubMenu = depth > 0; const isSubMenu = depth > 0;
const wrapperRef = useRef(null); const wrapperRef = useRef(null);
const triggerRef = useRef(null);
const menuRef = useRef(null); const menuRef = useRef(null);
// Use setAttribute instead of the React style prop because React silently strips unknown CSS // use setAttribute instead of the React style prop because React strips unknown CSS
// properties (like anchor-name) from inline styles in browsers that don't support them. // properties (like anchor-name) from inline styles in browsers that don't support them.
// setAttribute writes raw CSS text that the anchor positioning polyfill can read. // setAttribute writes raw CSS text that the anchor positioning polyfill can read
useEffect(()=>{ useEffect(()=>{
wrapperRef.current?.setAttribute('style', `anchor-name: ${anchorName}`); triggerRef.current?.setAttribute('style', `anchor-name: ${anchorName}`);
menuRef.current?.setAttribute('style', `position-anchor: ${anchorName}`); menuRef.current?.setAttribute('style', `position-anchor: ${anchorName}`);
}, [anchorName]); }, [anchorName]);
@@ -78,6 +79,7 @@ const Dropdown = ({ groupName, className = null, icon, children, color = null, c
aria-haspopup='menu' aria-haspopup='menu'
role='menuitem' role='menuitem'
disabled={children.length > 0 ? false : true} disabled={children.length > 0 ? false : true}
ref={triggerRef}
> >
{trigger(groupName)} {trigger(groupName)}
</button> </button>
+1
View File
@@ -7,6 +7,7 @@
} }
.menu-list { .menu-list {
position : fixed;
z-index : 1000; z-index : 1000;
inset-block-start: anchor(bottom); inset-block-start: anchor(bottom);
inset-inline-start: anchor(left); inset-inline-start: anchor(left);