ssb: Make the search box behave better on mobile.
Some checks failed
Build Tilde Friends / Build-All (push) Has been cancelled
Some checks failed
Build Tilde Friends / Build-All (push) Has been cancelled
This commit is contained in:
@@ -753,7 +753,13 @@ class TfElement extends LitElement {
|
||||
}
|
||||
|
||||
search() {
|
||||
this.set_hash('#q=' + this.renderRoot.getElementById('search_text').value);
|
||||
let search_text = this.renderRoot.getElementById('search_text');
|
||||
if (!search_text.value.length) {
|
||||
search_text.focus();
|
||||
this.set_tab('search');
|
||||
} else {
|
||||
this.set_hash('#q=' + search_text.value);
|
||||
}
|
||||
}
|
||||
|
||||
search_keydown(event) {
|
||||
@@ -825,8 +831,8 @@ class TfElement extends LitElement {
|
||||
`
|
||||
: undefined
|
||||
}
|
||||
<button class="w3-bar-item w3-button w3-right" @click=${this.search}>🔍Search</button>
|
||||
<input type="text" class="w3-input w3-bar-item w3-right w3-theme-d1" placeholder="keywords, @id, #channel" id="search_text" @keydown=${this.search_keydown}></input>
|
||||
<button class="w3-bar-item w3-button w3-right" @click=${this.search}>🔍<span class="w3-hide-small">Search</span></button>
|
||||
<input type="text" class=${'w3-input w3-bar-item w3-right w3-theme-d1' + (this.tab == 'search' ? ' w3-mobile' : ' w3-hide-small')} placeholder="keywords, @id, #channel" id="search_text" @keydown=${this.search_keydown}></input>
|
||||
</div>
|
||||
`;
|
||||
let contents = this.guest
|
||||
|
||||
Reference in New Issue
Block a user