Skip to content

Commit

Permalink
Improved: search text should selected on focus for better user experi…
Browse files Browse the repository at this point in the history
…ence (#1uvvc2n)
  • Loading branch information
adityasharma7 committed Feb 2, 2023
1 parent 267e54d commit 7089643
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/views/Catalog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</ion-toolbar>
</ion-header>
<ion-content>
<ion-searchbar v-model="queryString" @keypress.enter="queryString = $event.target.value; getProducts()" />
<ion-searchbar @ionFocus="selectSearchBarText($event)" v-model="queryString" @keypress.enter="queryString = $event.target.value; getProducts()" />
<main>
<ion-card v-for="product in products.list" :key="product.productId">
<Image :src="product.mainImageUrl" />
Expand Down Expand Up @@ -99,6 +99,11 @@ export default defineComponent({
};
await this.store.dispatch("product/findProduct", payload);
},
selectSearchBarText(event: any) {
event.target.getInputElement().then((element: any) => {
element.select();
})
},
},
async ionViewWillEnter() {
Expand Down

0 comments on commit 7089643

Please sign in to comment.