Modify playbar to not allow audio control shortcuts based on search active
This commit is contained in:
parent
48f74ae26f
commit
9c1c8a6a1e
@ -350,7 +350,7 @@ fn QueueToggle(status: RwSignal<PlayStatus>) -> impl IntoView {
|
||||
pub fn PlayBar(status: RwSignal<PlayStatus>) -> impl IntoView {
|
||||
// Listen for key down events -- arrow keys don't seem to trigger key press events
|
||||
let _arrow_key_handle = window_event_listener(ev::keydown, move |e: ev::KeyboardEvent| {
|
||||
if e.key() == "ArrowRight" {
|
||||
if e.key() == "ArrowRight" && status.with_untracked(|status| status.search_active) == false {
|
||||
e.prevent_default();
|
||||
log!("Right arrow key pressed, skipping forward by {} seconds", ARROW_KEY_SKIP_TIME);
|
||||
|
||||
@ -363,7 +363,7 @@ pub fn PlayBar(status: RwSignal<PlayStatus>) -> impl IntoView {
|
||||
error!("Unable to skip forward: Unable to get current duration");
|
||||
}
|
||||
|
||||
} else if e.key() == "ArrowLeft" {
|
||||
} else if e.key() == "ArrowLeft" && status.with_untracked(|status| status.search_active) == false {
|
||||
e.prevent_default();
|
||||
log!("Left arrow key pressed, skipping backward by {} seconds", ARROW_KEY_SKIP_TIME);
|
||||
|
||||
@ -380,7 +380,7 @@ pub fn PlayBar(status: RwSignal<PlayStatus>) -> impl IntoView {
|
||||
|
||||
// Listen for space bar presses to play/pause
|
||||
let _space_bar_handle = window_event_listener(ev::keypress, move |e: ev::KeyboardEvent| {
|
||||
if e.key() == " " {
|
||||
if e.key() == " " && status.with_untracked(|status| status.search_active) == false {
|
||||
e.prevent_default();
|
||||
log!("Space bar pressed, toggling play/pause");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user