Skip to content

Focus+select the quantity input in the stock add/count/remove dialog#11539

Open
martonmiklos wants to merge 8 commits into
inventree:masterfrom
martonmiklos:select_and_focus_qty_in_stock_add_count_remove
Open

Focus+select the quantity input in the stock add/count/remove dialog#11539
martonmiklos wants to merge 8 commits into
inventree:masterfrom
martonmiklos:select_and_focus_qty_in_stock_add_count_remove

Conversation

@martonmiklos
Copy link
Copy Markdown
Contributor

Initial PR for review.
The selectAndFocus attribute is only propagated to the Numeric input types.
Shall I implement it for all the input types?
Should I separate them?

Maybe the implementation should be done in two PRs: one for providing the select and focus "API" and the second for the stock dialogs?

Fixes #11511

@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 16, 2026

Deploy Preview for inventree-web-pui-preview ready!

Name Link
🔨 Latest commit 12db7e0
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/6a14b08372ba4700089d96bf
😎 Deploy Preview https://deploy-preview-11539--inventree-web-pui-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@martonmiklos martonmiklos force-pushed the select_and_focus_qty_in_stock_add_count_remove branch from 3a5f426 to d28b282 Compare March 16, 2026 12:30
Comment thread src/frontend/src/components/forms/fields/NumberField.tsx Outdated
@SchrodingersGat SchrodingersGat added this to the 1.4.0 milestone Mar 25, 2026
@SchrodingersGat
Copy link
Copy Markdown
Member

@martonmiklos please address my question as above

@SchrodingersGat
Copy link
Copy Markdown
Member

@martonmiklos update?

@martonmiklos
Copy link
Copy Markdown
Contributor Author

@martonmiklos update?

I will dedicate some time to InvenTree this weekend + Monday and will get this through.

onOpen: () => {
setTimeout(() => {
const input = document.querySelector<HTMLInputElement>(
'#number-field-quantity, input[aria-label="number-field-quantity"]'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if that is the best way to solve it as i can see these label changing in the future but I also do not have a better proposal; thoughts @SchrodingersGat ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like a bit of an anti-pattern to me - we should be able to set it with normal properties, not trying to introspect the DOM

@SchrodingersGat SchrodingersGat modified the milestones: 1.4.0, 1.5.0 Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FR]Set focus and select the quantity field in the Add/remove stock dialog

3 participants