Fix bug with multi select and alt+tab
This commit is contained in:
parent
21bed5b710
commit
fb6e7e036b
@ -1,4 +1,4 @@
|
||||
import React, { useRef, useState, useContext } from "react";
|
||||
import React, { useRef, useState, useContext, useEffect } from "react";
|
||||
import { Button, Flex, Label } from "theme-ui";
|
||||
import shortid from "shortid";
|
||||
import Case from "case";
|
||||
@ -309,6 +309,18 @@ function SelectMapModal({
|
||||
|
||||
useKeyboard(handleKeyDown, handleKeyUp);
|
||||
|
||||
// Set select mode to single when alt+tabing
|
||||
useEffect(() => {
|
||||
function handleBlur() {
|
||||
setSelectMode("single");
|
||||
}
|
||||
|
||||
window.addEventListener("blur", handleBlur);
|
||||
return () => {
|
||||
window.removeEventListener("blur", handleBlur);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Modal
|
||||
isOpen={isOpen}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import React, { useRef, useContext, useState } from "react";
|
||||
import React, { useRef, useContext, useState, useEffect } from "react";
|
||||
import { Flex, Label, Button } from "theme-ui";
|
||||
import shortid from "shortid";
|
||||
import Case from "case";
|
||||
@ -183,6 +183,18 @@ function SelectTokensModal({ isOpen, onRequestClose }) {
|
||||
|
||||
useKeyboard(handleKeyDown, handleKeyUp);
|
||||
|
||||
// Set select mode to single when alt+tabing
|
||||
useEffect(() => {
|
||||
function handleBlur() {
|
||||
setSelectMode("single");
|
||||
}
|
||||
|
||||
window.addEventListener("blur", handleBlur);
|
||||
return () => {
|
||||
window.removeEventListener("blur", handleBlur);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Modal
|
||||
isOpen={isOpen}
|
||||
|
Loading…
Reference in New Issue
Block a user