mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-23 23:09:37 +02:00
navbar: Allow the typing of slash in input/textarea fields
This commit is contained in:
parent
6d80969fdc
commit
bc08362a4c
1 changed files with 4 additions and 3 deletions
|
@ -17,7 +17,8 @@
|
||||||
|
|
||||||
// Event listener for focusing input
|
// Event listener for focusing input
|
||||||
function handleKeydown(event: KeyboardEvent) {
|
function handleKeydown(event: KeyboardEvent) {
|
||||||
if (event.key === '/' && document.activeElement !== inputElement) {
|
// Ignore any keypresses in an input/textarea field, so we don't interfere with typing.
|
||||||
|
if (event.key === '/' && !["INPUT", "TEXTAREA"].includes((event.target as HTMLElement)?.tagName)) {
|
||||||
event.preventDefault(); // Prevent browser's search shortcut
|
event.preventDefault(); // Prevent browser's search shortcut
|
||||||
if (inputElement) {
|
if (inputElement) {
|
||||||
inputElement.focus();
|
inputElement.focus();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue