Skip to content

fix(tree, tree-item): works when tree is the topmost element in a shadow root where it has no parent #5472

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

Merged
merged 12 commits into from
Oct 18, 2022

Conversation

Elijbet
Copy link
Contributor

@Elijbet Elijbet commented Oct 13, 2022

Related Issue: #5333

Resolves #5464 as well, stems from #4814.

Summary

Adds optional chaining to get rid of the typeError in cases when there is no parentEl.

Project #adoptatree is good to go.

@Elijbet Elijbet changed the title fix(tree, tree-item): works when tree is in the root node, in cases when there is no parentEl fix(tree, tree-item): works when tree is in the root node for cases when there is no parentEl Oct 13, 2022
@github-actions github-actions bot added the bug Bug reports for broken functionality. Issues should include a reproduction of the bug. label Oct 13, 2022
@Elijbet Elijbet marked this pull request as ready for review October 13, 2022 21:05
@Elijbet Elijbet requested a review from a team as a code owner October 13, 2022 21:05
@Elijbet Elijbet requested review from jcfranco and benelan October 13, 2022 21:07
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.

This is great, @Elijbet. Aside from some test comments, this LGTM!

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.

👐👐👐👐👐👐👐
👐👐🌳👐🌳👐👐
👐🌳🌳🌳🌳🌳👐
👐👐🌳👐🌳👐👐
👐🌳🌳🌳🌳🌳👐
👐👐🌳👐🌳👐👐
👐👐👐👐👐👐👐

👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐
👐🌳🌳🌳🌳👐🌳🌳🌳👐👐👐🌳🌳👐👐🌳🌳🌳👐👐🌳🌳🌳🌳🌳👐
👐🌳👐👐🌳👐🌳👐👐🌳👐🌳👐👐🌳👐🌳👐👐🌳👐👐👐🌳👐👐👐
👐🌳🌳🌳🌳👐🌳👐👐🌳👐🌳👐👐🌳👐🌳🌳🌳👐👐👐👐🌳👐👐👐
👐🌳👐👐🌳👐🌳👐👐🌳👐🌳👐👐🌳👐🌳👐👐👐👐👐👐🌳👐👐👐
👐🌳👐👐🌳👐🌳🌳🌳👐👐👐🌳🌳👐👐🌳👐👐👐👐👐👐🌳👐👐👐
👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐

👐👐👐👐👐👐
👐🌳🌳🌳🌳👐
👐🌳👐👐🌳👐
👐🌳🌳🌳🌳👐
👐🌳👐👐🌳👐
👐🌳👐👐🌳👐
👐👐👐👐👐👐

👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐
👐🌳🌳🌳🌳🌳👐🌳🌳🌳👐👐🌳🌳🌳🌳👐🌳🌳🌳🌳👐
👐👐👐🌳👐👐👐🌳👐👐🌳👐🌳👐👐👐👐🌳👐👐👐👐
👐👐👐🌳👐👐👐🌳🌳🌳👐👐🌳🌳🌳👐👐🌳🌳🌳👐👐
👐👐👐🌳👐👐👐🌳👐🌳👐👐🌳👐👐👐👐🌳👐👐👐👐
👐👐👐🌳👐👐👐🌳👐👐🌳👐🌳🌳🌳🌳👐🌳🌳🌳🌳👐
👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐👐

@Elijbet Elijbet changed the title fix(tree, tree-item): works when tree is in the root node for cases when there is no parentEl fix(tree, tree-item): works when tree is the topmost element in a shadow root where it has no parent Oct 14, 2022
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.

One more pass on the test and I think this will be good to merge!

@Elijbet Elijbet added the pr ready for visual snapshots Adding this label will run visual snapshot testing. label Oct 14, 2022
@macandcheese
Copy link
Contributor

A accepted Screener - it was an unrelated new screenshot from Block changes.

@Elijbet Elijbet dismissed jcfranco’s stale review October 14, 2022 22:22

This feedback has been addressed.

@Elijbet Elijbet removed the request for review from benelan October 14, 2022 22:23
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.

✨🌳✨

@@ -283,7 +283,7 @@ export class Tree {
}

// When focus is on a child node that is also either an end node or a closed node, moves focus to its parent node.
const parentItem = target.parentElement.closest("calcite-tree-item");
const parentItem = target.parentElement?.closest("calcite-tree-item");
Copy link
Member

Choose a reason for hiding this comment

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

Per our convo, this and the updates below (updateAncestorTree) wouldn't need the optional chaining operator as the event is processed after it bubbles, so we can assume there's an ancestor chain. This can be refactored later.

@jcfranco jcfranco merged commit 8ac3785 into master Oct 18, 2022
@jcfranco jcfranco deleted the elijbet/5333-update-tree-to-work-without-parent branch October 18, 2022 17:26
anveshmekala added a commit that referenced this pull request Oct 19, 2022
* feat(rating): add built-in translations

* set asset dir

* add initial message load

* add effectiveLocale watcher

* fix outdated reference

* update lang switch helper to account for strings used in rendering

* feat(time-picker, input-time-picker): add numberingSystem property (#5301)

* feat(time-picker, input-time-picker): add numberingSystem property for localization

* wip: need to correctly apply numberingSystem on InputInput

* use NumberStringFormat to delocalize time

* cleanup

* delocalize time on blur

* test(input-time-picker): fix e2e failures and add numberingSystem story

* use formatter's format method instead of localize for performance

* cleanup

* fix(input-time-picker): don't pass through lang and numberingSystem to calcite-input

* fix test

* use NumberStringFormat's  setter instead of setOptions

Co-authored-by: Ben Elan <[email protected]>

* refactor(block): move hardcoded classes to CSS object (#5474)

* fix(input, input-number, input-text): fix input icons not displaying properly in Firefox (#5475)

#5417

* ci(next): clean docs build before deployment (#5476)

* ci(prepReleaseCommit): skip git sanity checks for next releases

* ci(next): clean docs build before deployment

* Revert "ci(prepReleaseCommit): skip git sanity checks for next releases"

This reverts commit 7cc2d8b.

Co-authored-by: Ben Elan <[email protected]>

* refactor(input-number, input-text): drop resize-icon selectors (#5477)

* fix(block): improve content layout (#5473)

#5422

* docs: update component READMEs (#5479)

Co-authored-by: jcfranco <[email protected]>

* docs: add backticks to props and values for consistency (#5485)

* docs: add backticks to props and values for consistency

* update prop ref

* review edits

* fix(date-picker): no longer hides year for zh-CN locale (#5344)

* fix(date-picker): no longer hides year for zn-CH locale

* add screener story

* fix locale typo

* fix  suffix placement

* docs(changelog): add missing breaking changes (#5469)

* feat(stepper, stepper-item): add numberingSystem property (#5467)

* feat(stepper, stepper-item): add numberingSystem property

* use setter for NumberStringFormat's options instead of setOptions

* change formatter options in effectiveLocale watcher

* cleanup

Co-authored-by: Ben Elan <[email protected]>

* fix(flow-item): fix scrollContentTo (#5487)

#5414

* ci(next): fix next releases take 3 (#5497)

* ci(next): fix next releases take 3

* cleanup

Co-authored-by: Ben Elan <[email protected]>

* fix(flow-item, panel): fix layout issue that would cause double scrollbars (#5486)

#5428

* 1.0.0-next.598

* docs: update component READMEs (#5501)

Co-authored-by: jcfranco <[email protected]>

* build(deps): bump eslint-plugin-jest from 27.1.1 to 27.1.2 (#5507)

Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 27.1.1 to 27.1.2.
- [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases)
- [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md)
- [Commits](jest-community/eslint-plugin-jest@v27.1.1...v27.1.2)

---
updated-dependencies:
- dependency-name: eslint-plugin-jest
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump shell-quote from 1.7.3 to 1.7.4 (#5503)

Bumps [shell-quote](https://github.com/ljharb/shell-quote) from 1.7.3 to 1.7.4.
- [Release notes](https://github.com/ljharb/shell-quote/releases)
- [Changelog](https://github.com/ljharb/shell-quote/blob/main/CHANGELOG.md)
- [Commits](ljharb/shell-quote@1.7.3...v1.7.4)

---
updated-dependencies:
- dependency-name: shell-quote
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump @typescript-eslint/eslint-plugin from 5.38.1 to 5.40.1 (#5506)

Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.38.1 to 5.40.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.40.1/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump @typescript-eslint/parser from 5.38.1 to 5.40.1 (#5504)

Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.38.1 to 5.40.1.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.40.1/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump eslint-plugin-jsdoc from 39.3.6 to 39.3.13 (#5505)

Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 39.3.6 to 39.3.13.
- [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
- [Commits](gajus/eslint-plugin-jsdoc@v39.3.6...v39.3.13)

---
updated-dependencies:
- dependency-name: eslint-plugin-jsdoc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix(tree, tree-item): works when tree is the topmost element in a shadow root where it has no parent (#5472)

#5333

* ci: fix next releases take 4 (#5500)

* ci: fix next releases take 4

* separate error messages

Co-authored-by: Ben Elan <[email protected]>

* 1.0.0-next.599

* fix(flow-item): Render back button first. (#5511)

* 1.0.0-next.600

* fix(tab): applies section styles onto the enclosing parent (#5516)

* WIP: temorary demo swap with the issue case

* fix(tab): applies section styles onto the enclosing parent

* revert to original demo

* cleanup

* TabChilrenWithPercentageHeights story

* cleanup

* swap parent selector for [role=tabpanel]

* Introduce a new class selector

* 1.0.0-next.601

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Ben Elan <[email protected]>
Co-authored-by: Ben Elan <[email protected]>
Co-authored-by: Calcite Admin <[email protected]>
Co-authored-by: jcfranco <[email protected]>
Co-authored-by: Kitty Hurley <[email protected]>
Co-authored-by: Anveshreddy mekala <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Eliza Khachatryan <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Matt Driscoll <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug reports for broken functionality. Issues should include a reproduction of the bug. 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.

CalciteTree.componentWillRender() throws error when <calcite-tree> is detached
3 participants