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

Closed
opened 2025-12-29 19:43:03 +01:00 by adam · 9 comments
Owner

Originally created by @tardoe on GitHub (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.

Originally created by @tardoe on GitHub (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.
adam added the type: bugpending closurestatus: under review labels 2025-12-29 19:43:03 +01:00
adam closed this issue 2025-12-29 19:43:03 +01:00
Author
Owner

@decoupca commented on GitHub (Jun 30, 2022):

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

@decoupca commented on GitHub (Jun 30, 2022): 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
Author
Owner

@PaulR282 commented on GitHub (Jul 1, 2022):

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

@PaulR282 commented on GitHub (Jul 1, 2022): It works perfectly for me on v3.2.5 / Chrome Windows.
Author
Owner

@kkthxbye-code commented on GitHub (Jul 1, 2022):

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

@kkthxbye-code commented on GitHub (Jul 1, 2022): I cannot replicate this on any of: Chrome (Windows), Firefox (Windows) and Safari (OS X).
Author
Owner

@ziggekatten commented on GitHub (Jul 4, 2022):

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.

@ziggekatten commented on GitHub (Jul 4, 2022): 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.
Author
Owner

@kkthxbye-code commented on GitHub (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:

29f629156a/netbox/project-static/src/select/api/apiSelect.ts (L405-L416)

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.

@kkthxbye-code commented on GitHub (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: ```javascript this.slim.slim.search.input.focus(); ``` After line 413 here: https://github.com/netbox-community/netbox/blob/29f629156a4ed2136c002480d9cf6238e64b686c/netbox/project-static/src/select/api/apiSelect.ts#L405-L416 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.
Author
Owner

@tardoe commented on GitHub (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.

@tardoe commented on GitHub (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.
Author
Owner

@jeremystretch commented on GitHub (Jul 18, 2022):

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

@jeremystretch commented on GitHub (Jul 18, 2022): Due a regression introduced by #9696 (and later by #9735), this change had to be reverted.
Author
Owner

@github-actions[bot] commented on GitHub (Oct 24, 2022):

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[bot] commented on GitHub (Oct 24, 2022): 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](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md).
Author
Owner

@github-actions[bot] commented on GitHub (Nov 24, 2022):

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[bot] commented on GitHub (Nov 24, 2022): 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.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6609