Skip to content

Commit

Permalink
Merge pull request #11966 from rak-phillip/bugfix/11928-focus-filter
Browse files Browse the repository at this point in the history
Allow the namespace filter to be selected after making selection in the dropdown
  • Loading branch information
rak-phillip authored Sep 19, 2024
2 parents 5607114 + b72a24c commit f9d6f31
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/po/components/namespace-filter.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class NamespaceFilterPo extends ComponentPo {
}

searchByName(label: string) {
return this.self().find('.ns-controls > .ns-input').clear().type(label);
return this.self().find('.ns-controls > .ns-input > .ns-filter-input').clear().type(label);
}

clearSearchFilter() {
Expand Down
12 changes: 12 additions & 0 deletions cypress/e2e/tests/pages/explorer2/namespace-picker.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,18 @@ describe('Namespace picker', { testIsolation: 'off' }, () => {
namespacePicker.checkIcon().should('have.length', 1);
});

it('can filter after making a selection', { tags: ['@explorer2', '@adminUser', '@standardUser'] }, () => {
namespacePicker.toggle();

// Select 'Project: Default'
namespacePicker.clickOptionByLabel('Project: Default');
namespacePicker.isChecked('Project: Default');
namespacePicker.checkIcon().should('have.length', 1);

namespacePicker.searchByName('default');
namespacePicker.getOptions().find('.ns-option').should('have.length.gte', 2);
});

it('can filter options by name', { tags: ['@explorer2', '@adminUser', '@standardUser'] }, () => {
namespacePicker.toggle();

Expand Down
6 changes: 5 additions & 1 deletion shell/components/nav/NamespaceFilter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -597,11 +597,14 @@ export default {
open() {
this.isOpen = true;
this.$nextTick(() => {
this.$refs.filter.focus();
this.focusFilter();
});
this.addCloseKeyHandler();
this.layout();
},
focusFilter() {
this.$refs.filter.focus();
},
close() {
this.isOpen = false;
this.activeElement = null;
Expand Down Expand Up @@ -798,6 +801,7 @@ export default {
v-model="filter"
tabindex="0"
class="ns-filter-input"
@click="focusFilter"
@keydown="inputKeyHandler($event)"
>
<i
Expand Down

0 comments on commit f9d6f31

Please sign in to comment.