fix(search): honor "Go to Link" on Enter; prevent Event-as-force bug

This commit is contained in:
aspen 2025-10-11 15:36:15 +00:00
parent f1c3d7b676
commit e0ef730adc

View file

@ -1,7 +1,7 @@
<template> <template>
<div class = "search-settings-row"> <div class = "search-settings-row">
<form <form
@submit.prevent="searchSubmitted" @submit.prevent="searchSubmitted()"
:class="minimalSearch ? 'minimal' : 'normal'" :class="minimalSearch ? 'minimal' : 'normal'"
> >
<label for="filter-tiles"> <label for="filter-tiles">
@ -381,6 +381,10 @@ export default {
/* Launch web search, to correct search engine, passing in users query */ /* Launch web search, to correct search engine, passing in users query */
searchSubmitted(force = false) { searchSubmitted(force = false) {
// If the first argument is an Event (from accidental binding), treat as not forced
if (force && typeof force === 'object' && 'preventDefault' in force) {
force = false; // eslint-disable-line no-param-reassign
}
const { searchPrefs, goToLinkEnabled } = this; const { searchPrefs, goToLinkEnabled } = this;
const input = this.input.trim(); const input = this.input.trim();
// 1. If not forcing web search, and "Go to Link" is enabled // 1. If not forcing web search, and "Go to Link" is enabled