Skip to content
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

Merged
merged 12 commits into from
Feb 3, 2023

Conversation

benelan
Copy link
Member

@benelan benelan commented Feb 1, 2023

Related Issue: #5147

Summary

Adds the public setFocus method to the delegatesFocus components that didn't have it. See #5147 (comment)

@benelan benelan requested a review from a team as a code owner February 1, 2023 01:18
@benelan benelan changed the title feat(pagination, split-button, dropdown, date-picker), action-group: add setFocus method feat(pagination, split-button, dropdown, date-picker) action-group): add setFocus method Feb 1, 2023
@macandcheese
Copy link
Contributor

@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.

@benelan
Copy link
Member Author

benelan commented Feb 1, 2023

@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 docs-json?

@macandcheese
Copy link
Contributor

macandcheese commented Feb 1, 2023

It doesn't add/remove sections automatically when stuff changes in docs-json?

Not anymore... we updated the Gatsby "mdx component" to accept a section prop so we could render heading tags in mdx and have them appended to the table of contents... the previous set up was easier since it rendered only what was available in docs-json, but we couldn't have sub-sections as the heading tags rendered in our Readme component weren't parsed by Gatsby (or, we could and did, but they didn't show up in the table of contents).

Copy link
Member

@jcfranco jcfranco left a 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");
Copy link
Member

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);
Copy link
Member

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).

Copy link
Member Author

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

@@ -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");
Copy link
Member

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.

* origin/master:
  docs(input-number, input-text): remove unsupported boolean type from type prop doc (#6394)
  ci(release): lint readme and changelog before committing (#6406)
  ci: allow multiple product team labels (#6411)
@benelan benelan added enhancement Issues tied to a new feature or request. pr ready for visual snapshots Adding this label will run visual snapshot testing. labels Feb 3, 2023
@benelan benelan merged commit ceaf532 into master Feb 3, 2023
@benelan benelan deleted the benelan/add-setfocus branch February 3, 2023 05:39
jcfranco pushed a commit that referenced this pull request Feb 4, 2023
…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)
benelan pushed a commit that referenced this pull request Feb 6, 2023
…group): add setFocus method (#6405)"

This reverts commit ceaf532.
benelan added a commit that referenced this pull request Feb 6, 2023
…group): add setFocus method (#6405)"

This reverts commit ceaf532.
benelan added a commit that referenced this pull request Feb 6, 2023
benelan added a commit that referenced this pull request Feb 7, 2023
…-group): add setFocus method (#6405)" (#6426)

This reverts commit ceaf532.


The commit above will be reinstalled in the next few days after we
release a patch.
benelan added a commit that referenced this pull request Feb 8, 2023
…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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Issues tied to a new feature or request. pr ready for visual snapshots Adding this label will run visual snapshot testing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants