Skip to content

Commit

Permalink
docs: examples dropdown closes properly (#9566)
Browse files Browse the repository at this point in the history
'Examples' popover in the website used to not close when you click outside of it. This is now fixed.

Fixes: #8750
  • Loading branch information
ilhan007 authored Jul 26, 2024
1 parent b32adf5 commit a6ca403
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/website/src/components/ExamplesMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ export default function ({loadHelloWorld, loadCounter, initialActiveState }) {
}, [dropdownRef]);

return (
<div className={clsx('navbar__item', 'dropdown', 'dropdown--hoverable', {
<div ref={dropdownRef} className={clsx('navbar__item', 'dropdown', {
'dropdown--show': showDropdown,
})}>

<a href="#" aria-haspopup="true" aria-expanded="false" role="button" className="navbar__link"
<a href="#" aria-haspopup="true" aria-expanded={showDropdown} role="button" className="navbar__link"
onClick={(e) => {
e.preventDefault();
setShowDropdown(!showDropdown);
Expand All @@ -47,7 +47,8 @@ export default function ({loadHelloWorld, loadCounter, initialActiveState }) {
className={clsx('dropdown__link', {"menu__link--active": active === "hello-world" })}
onClick={() => {
setActive("hello-world");
loadHelloWorld()
loadHelloWorld();
setShowDropdown(false);
}}>
Hello World
</Link>
Expand All @@ -58,6 +59,7 @@ export default function ({loadHelloWorld, loadCounter, initialActiveState }) {
onClick={() => {
setActive("counter");
loadCounter();
setShowDropdown(false);
}}>
Counter
</Link>
Expand Down

0 comments on commit a6ca403

Please sign in to comment.