Only focus when menu item is clicked

This commit is contained in:
Lim Chee Aun 2023-08-06 16:54:13 +08:00
parent c13e148b36
commit 0b3875c2cf

View file

@ -848,10 +848,12 @@ function Status({
state={isContextMenuOpen ? 'open' : undefined} state={isContextMenuOpen ? 'open' : undefined}
anchorPoint={contextMenuAnchorPoint} anchorPoint={contextMenuAnchorPoint}
direction="right" direction="right"
onClose={() => { onClose={(e) => {
setIsContextMenuOpen(false); setIsContextMenuOpen(false);
// statusRef.current?.focus?.(); // statusRef.current?.focus?.();
statusRef.current?.closest('[tabindex]')?.focus?.(); if (e?.reason === 'click') {
statusRef.current?.closest('[tabindex]')?.focus?.();
}
}} }}
portal={{ portal={{
target: document.body, target: document.body,