Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter fields on drop downs don't gain focus automatically #9632

Closed
tardoe opened this issue Jun 30, 2022 · 9 comments · Fixed by #9696
Closed

Filter fields on drop downs don't gain focus automatically #9632

tardoe opened this issue Jun 30, 2022 · 9 comments · Fixed by #9696
Labels
pending closure Requires immediate attention to avoid being closed for inactivity status: under review Further discussion is needed to determine this issue's scope and/or implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@tardoe
Copy link

tardoe commented Jun 30, 2022

NetBox version

v3.1.11

Python version

3.9

Steps to Reproduce

  1. Go to the sites list
  2. Select the filter tab
  3. Click the "Region", "Tenant", "Site Group" or any other drop-down option that prompts you with a "filter" search box - the cursor isn't automatically focussed to this filter text field.

Expected Behavior

Like the "Status" and "Tags" filter fields that present a "search" input text box, all filtering text inputs should automatically gain keyboard focus for 0-click text entry.

Observed Behavior

The "filter" field text boxes remain unfocussed and require an additional mouse-click.

@tardoe tardoe added the type: bug A confirmed report of unexpected behavior in the application label Jun 30, 2022
@jeremystretch jeremystretch added the status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation label Jun 30, 2022
@decoupca
Copy link
Contributor

I notice that Tags and Status behaves slightly differently from all other fields. Clicking Tags or Status instantly brings down the dropdown with no change to the "select status" field. Other fields like Region, Tenant, etc all briefly highlight the "select region" field before passing off to the "filter" input. so looks like those fields steal focus briefly before (probably) handing it off to the filter input.

tags/status always auto-focuses for me, but all other fields intermittently do or don't auto-focus every time I click.

On 3.1.2 / macOS Safari

@PaulR282
Copy link

PaulR282 commented Jul 1, 2022

It works perfectly for me on v3.2.5 / Chrome Windows.

@kkthxbye-code
Copy link
Contributor

I cannot replicate this on any of: Chrome (Windows), Firefox (Windows) and Safari (OS X).

@ziggekatten
Copy link

It seems to depend on how many objects you have in the database. A brand new empty installation has no issues, but as soon as we imported some 800 tenants, it directly occurs in the Tenant dropdown.

@kkthxbye-code
Copy link
Contributor

kkthxbye-code commented Jul 4, 2022

I managed to replicate it using the throttle feature in chrome. So it happens when the API is slow to respond when the select field populates the data. The field is disabled when it's loading data, so slim-select sets the focus while the search field is disabled if the API is too slow to respond.

Can be fixed by inserting:

this.slim.slim.search.input.focus();

After line 413 here:

private async loadData(): Promise<void> {
try {
this.disable();
await this.getOptions('replace');
} catch (err) {
console.error(err);
} finally {
this.setOptionStyles();
this.enable();
this.base.dispatchEvent(this.loadEvent);
}
}

I don't have a time to test i properly right now. If anyone wants to test it properly and submit a PR, feel free. Otherwise I'll probably get to it at some point.

@tardoe
Copy link
Author

tardoe commented Jul 7, 2022

@kkthxbye-code seems to have nailed it here - I'm using an instance hosted on another continent with reasonable latency loading select field items. While we don't have many field items, the loading time appears to be enough to trigger this.

@kkthxbye-code kkthxbye-code added status: accepted This issue has been accepted for implementation and removed status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation labels Jul 10, 2022
@kkthxbye-code kkthxbye-code self-assigned this Jul 10, 2022
jeremystretch added a commit that referenced this issue Jul 11, 2022
Fixes #9632 - Focus on select field after populating data
jeremystretch added a commit that referenced this issue Jul 11, 2022
@jeremystretch
Copy link
Member

Due a regression introduced by #9696 (and later by #9735), this change had to be reverted.

@jeremystretch jeremystretch reopened this Jul 18, 2022
@jeremystretch jeremystretch added status: under review Further discussion is needed to determine this issue's scope and/or implementation and removed status: accepted This issue has been accepted for implementation labels Jul 18, 2022
@kkthxbye-code kkthxbye-code removed their assignment Aug 24, 2022
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.

@github-actions github-actions bot added the pending closure Requires immediate attention to avoid being closed for inactivity label Oct 24, 2022
@github-actions
Copy link

This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 24, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pending closure Requires immediate attention to avoid being closed for inactivity status: under review Further discussion is needed to determine this issue's scope and/or implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants