Fix navbar event listener

This commit is contained in:
Eduard Heimbuch
2023-11-21 13:55:35 +01:00
parent 14f1cb0218
commit fd807495ea
3 changed files with 11 additions and 4 deletions

View File

@@ -0,0 +1,2 @@
- type: fixed
description: Window event listener on navbar

View File

@@ -22,7 +22,7 @@
* SOFTWARE.
*/
import React, {FC, useEffect, useRef, useState} from "react";
import React, { FC, useEffect, useRef, useState } from "react";
import { Links } from "@scm-manager/ui-types";
import classNames from "classnames";
import styled from "styled-components";
@@ -107,8 +107,13 @@ const NavigationBar: FC<Props> = ({ links }) => {
const [t] = useTranslation("commons");
const notificationsRef = useRef<HTMLButtonElement>(null);
useEffect(() => {
const close = () => {
if (burgerActive) {
const close = (event: MouseEvent) => {
const classList = event.target.classList.value;
if (
!classList.includes("navbar-burger") &&
!classList.includes("navbar-brand") &&
!classList.includes("search-box")
) {
setBurgerActive(false);
}
};

View File

@@ -205,7 +205,7 @@ const OmniSearch: FC<Props> = ({ shouldClear }) => {
})}
>
<SearchBox query={query} onQueryChange={setQuery} shouldClear={shouldClear}>
<SearchBox.Input className="is-small" placeholder={t("search.placeholder")} ref={searchInputRef} />
<SearchBox.Input className="is-small search-box" placeholder={t("search.placeholder")} ref={searchInputRef} />
<SearchBox.Options>{entries}</SearchBox.Options>
</SearchBox>
</div>