Focus search bar when open and allow opening it with [/]
This commit is contained in:
@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased](https://codeberg.org/daudix/duckquill/compare/v5.3.2...main)
|
## [Unreleased](https://codeberg.org/daudix/duckquill/compare/v5.3.2...main)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Allow opening search by pressing the slash key.
|
||||||
|
- Focus search after opening it.
|
||||||
|
|
||||||
## [5.3.2](https://codeberg.org/daudix/duckquill/compare/v5.3.1...v5.3.2)
|
## [5.3.2](https://codeberg.org/daudix/duckquill/compare/v5.3.1...v5.3.2)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
@ -194,8 +194,16 @@
|
|||||||
var searchBar = document.getElementById("search-bar");
|
var searchBar = document.getElementById("search-bar");
|
||||||
searchContainer.classList.toggle("active");
|
searchContainer.classList.toggle("active");
|
||||||
searchBar.toggleAttribute("disabled");
|
searchBar.toggleAttribute("disabled");
|
||||||
|
searchBar.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document.addEventListener("keydown", function(event) {
|
||||||
|
if (event.key === "/") {
|
||||||
|
event.preventDefault();
|
||||||
|
toggleSearch();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (document.readyState === "complete" ||
|
if (document.readyState === "complete" ||
|
||||||
(document.readyState !== "loading" && !document.documentElement.doScroll)
|
(document.readyState !== "loading" && !document.documentElement.doScroll)
|
||||||
) {
|
) {
|
||||||
|
Reference in New Issue
Block a user