-
Notifications
You must be signed in to change notification settings - Fork 114
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
fix(combobox): controlled autocomplete cursor placement onInputValueChange bug #2647
Conversation
🦋 Changeset detectedLatest commit: 4326a80 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for paste-theme-designer ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for paste-docs ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 50e9a4e:
|
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
Size Change: +61 B (0%) Total Size: 639 kB
ℹ️ View Unchanged
|
packages/paste-core/components/combobox/stories/index.stories.tsx
Outdated
Show resolved
Hide resolved
If we decide not to add the workaround prop, I think we should at least fix it on the docs site. Seems like people are looking at that example, so it'd be good to at least have it working there. |
a6f9303
to
70e9b8d
Compare
Yeah, planning on just having "the correct docs" as the fix to the problem after further investigating this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just the changeset
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
woop woop!
70e9b8d
to
50e9a4e
Compare
Fixes #2618 |
50e9a4e
50e9a4e
to
4326a80
Compare
This is a super annoying bug in Downshift that's been open for 2 years. downshift-js/downshift#1108
They actually, kind of allude to it here in the Github docs https://github.com/downshift-js/downshift#oninputvaluechange, where they link to some old issue and some hints towarsds a fix.
Basically, we're doing it wrong. If you're trying to use the combobox in a controlled mannor, you should be using
defaultInputValue
, notinputValue
, and let Downshift manage the internal state afterwards. We re-mapinputValue
todefaultInputValue
to address this. This should have no detrimental impact to the consumer and should just "fix the problem" with no code changes.For folks using the hook, we're doing it wrong again. You want to set the initial value and selected item, and let Downshift take over from there. In this case I have just updated the Docs example.