-
Notifications
You must be signed in to change notification settings - Fork 111
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
[#1060] Adjust docs/typings for initialFocus option #1062
Conversation
Fixes #1060 The option can _also_ be set to `undefined` or a function that returns `undefined`.
🦋 Changeset detectedLatest commit: 7d4024b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
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.
Unfortunately, that doesn't solve the problem. Being able to specify a function that always returns undefined
is not really more helpful than specifying undefined
directly. Instead, we would need something like FocusTargetValueOrFalse | (() => FocusTargetValueOrFalse | undefined) | undefined
.
FYI, the information I get with your changes when trying initialFocus: () => someCondition ? someElement : undefined
:
Type '() => HTMLElement | undefined' is not assignable to type 'FocusTargetOrFalse | (() => undefined) | undefined'.
@FloEdelmann Thanks for checking it out. You're right, I was able to reproduce the error. I think the fix is simply changing the function type to |
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.
Indeed, that seems to work fine 🙂
Thanks for fixing this so quickly!
I will push this out next early next week. |
Published in v7.5.3 |
Fixes #1060
The option can also be set to
undefined
or a function that returnsundefined
.PR Checklist
Please leave this checklist in your PR.
npm run demo-bundle
in your branch and include the/docs/demo-bundle.js
file that gets generated in your PR).// TEST MANUALLY
comments here) that can't be fully tested in Cypress have been manually verified.typeof document/window !== 'undefined'
before using it in code that gets executed on load.npm run changeset
locally to add one, and follow the prompts).