Skip to content

Commit d3c2d75

Browse files
author
Beyzanur Seyhan
committed
Dropdown menu don't closed
1 parent 1ba7dc6 commit d3c2d75

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

components/Sort.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ export default function Sort() {
7676
return SortTypes.BestMatch;
7777
}
7878
};
79+
80+
const handleClick = () => {
81+
const elem = document.activeElement as HTMLElement;
82+
if(elem){
83+
elem?.blur();
84+
}
85+
};
7986
return (
8087
<div className="flex justify-center items-center mb-8 flex-col gap-2">
8188
<div className="dropdown dropdown-hover">
@@ -89,7 +96,7 @@ export default function Sort() {
8996
<div className="h-64 p-2 overflow-y-scroll shadow dropdown-content z-50 bg-base-100 rounded-box w-60">
9097
<ul tabIndex={0} className="menu menu-vertical">
9198
{mainLanguages.sort(sortByName).map(language => (
92-
<li key={language}>
99+
<li key={language} onClick={handleClick}>
93100
<Link href={`/repos/${language.toLowerCase()}`}>
94101
{language}
95102
</Link>
@@ -109,7 +116,7 @@ export default function Sort() {
109116
<div className="h-64 p-2 z-50 overflow-y-scroll shadow dropdown-content bg-base-100 rounded-box w-60">
110117
<ul tabIndex={0} className="menu menu-vertical">
111118
{navigationItems.map((item, index) => (
112-
<li key={index}>
119+
<li key={index} onClick={handleClick}>
113120
<Link href={{ query: item.href.query }}>
114121
{item.name}
115122
</Link>

0 commit comments

Comments
 (0)