-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update ft-input for top navbar search input to behave more like Youtu…
…be one (#3793) * * Update ft-input for top navbar search input to behave more like Youtube one * * Implement mouseleave = deselect * ! Fix clicking option/enter causes incorrect displayed input * * Update search input to update input data based on KB selected suggesion value on keydown * * Allow suggesion deselection via arrow up/down * $ Fix naming, import code style * - Remove unused import
- Loading branch information
1 parent
b2d95eb
commit d8ed6b9
Showing
7 changed files
with
90 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* This will return true if a string is null, undefined or empty. | ||
* @param {string|null|undefined} _string the string to process | ||
* @returns {boolean} whether the string is empty or not | ||
*/ | ||
export function isNullOrEmpty(_string) { | ||
return _string == null || _string === '' | ||
} | ||
|
||
/** | ||
* Is KeyboardEvent.key a printable char | ||
* @param {string} eventKey the string from KeyboardEvent.key to process | ||
* @returns {boolean} whether the string from KeyboardEvent.key is a printable char or not | ||
*/ | ||
export function isKeyboardEventKeyPrintableChar(eventKey) { | ||
// Most printable chars are all strings with length 1 (except Unicode) | ||
// https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values | ||
// https://www.w3.org/TR/DOM-Level-3-Events-key/ | ||
if (eventKey.length === 1) { return true } | ||
// Emoji | ||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Unicode_character_class_escape | ||
if (/\p{Emoji_Presentation}/u.test(eventKey)) { return true } | ||
|
||
return false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters