-
Notifications
You must be signed in to change notification settings - Fork 76
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
feat(pagination, split-button, dropdown, date-picker) action-group): add setFocus method #6405
Conversation
* origin/master: 1.0.4-next.5 fix(stepper-item): no longer refer numberingSystem from neighbor stepper component (#6380)
…ents into benelan/add-setfocus * 'benelan/add-setfocus' of github.com:esri/calcite-components: test(pagination): add focusable coverage
@geospatialem lets make sure to add the Methods readme component section on the docs site for these when this lands for those components without it currently. |
It doesn't add/remove sections automatically when stuff changes in |
Not anymore... we updated the Gatsby "mdx component" to accept a |
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.
Awesome!
@@ -209,7 +213,7 @@ describe("calcite-date-picker", () => { | |||
await page.setContent("<calcite-date-picker value='2000-11-27'></calcite-date-picker>"); | |||
const date = await page.find("calcite-date-picker"); | |||
const changedEvent = await page.spyOnEvent("calciteDatePickerChange"); | |||
await date.setProperty("value", "2001-10-28"); | |||
date.setProperty("value", "2001-10-28"); |
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.
Nice cleanup. Could you also add a await page.waitForChanges();
here?
/** Sets focus on the component's first focusable element. */ | ||
@Method() | ||
async setFocus(): Promise<void> { | ||
await componentLoaded(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.
Sidebar: maybe we need a new util or to update focusElement
to do this for us (wait for load then focus).
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.
Yeah that could be nice. Matt started a PR (#6156) to try to cut down the setFocus
boilerplate but from our discussion it sounds like we can't use componentOnReady()
internally. So your suggestion is a good plan B
src/tests/commonTests.ts
Outdated
@@ -213,14 +213,14 @@ export async function focusable(componentTagOrHTML: TagOrHTML, options?: Focusab | |||
const tag = getTag(componentTagOrHTML); | |||
const element = await page.find(tag); | |||
const focusTargetSelector = options?.focusTargetSelector || tag; | |||
|
|||
await element.callMethod("componentOnReady"); |
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.
Is this needed? page.waitForChanges()
already does this.
…add setFocus method (#6405) **Related Issue:** #5147 ## Summary Adds the public `setFocus` method to the `delegatesFocus` components that didn't have it. See #5147 (comment)
…group): add setFocus method (#6405)
…c-rulez * origin/master: docs: update component READMEs (#6352) ci(next): fix commit message (#6425) fix(vite): resolve lazying loading error in dist build (#6436) docs(changelog): remove reverted feature (#6435) revert: "feat(pagination, split-button, dropdown, date-picker) action-group): add setFocus method (#6405)" (#6426) 1.1.0-next.2 docs(segmented-control): update event description for calciteSegmentedControlChange (#6428) fix(tree-item): reverses regression to bring back focus when navigating with keyboard (#6424) fix(icon): fix icon normalization to handle x-times-named icons (#6422)
Related Issue: #5147
Summary
Adds the public
setFocus
method to thedelegatesFocus
components that didn't have it. See #5147 (comment)