-
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
refactor(table): refactor internals to work around HTML parser issue #10649
refactor(table): refactor internals to work around HTML parser issue #10649
Conversation
packages/calcite-components/src/components/table-row/table-row.tsx
Outdated
Show resolved
Hide resolved
packages/calcite-components/src/components/table-row/table-row.tsx
Outdated
Show resolved
Hide resolved
@@ -410,11 +410,27 @@ export class TableRow extends LitElement implements InteractiveComponent { | |||
ariaSelected={this.selected} | |||
class={{ [CSS.lastVisibleRow]: this.lastVisibleRow }} | |||
onKeyDown={this.keyDownHandler} | |||
ref={this.tableRowEl} | |||
ref={(el) => { | |||
if (!el || this.tableRowEl) { |
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.
TODO: improve how internal structure is updated, cleaned up
@@ -108,7 +108,7 @@ export class Table extends LitElement implements LoadableComponent { | |||
* @notPublic | |||
*/ | |||
/** TODO: [MIGRATION] This component has been updated to use the useT9n() controller. Documentation: https://qawebgis.esri.com/arcgis-components/?path=/docs/references-t9n-for-components--docs */ | |||
messages = useT9n<typeof T9nStrings>(); | |||
messages = useT9n<typeof T9nStrings>({ blocking: true }); |
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.
TODO: need to investigate why blocking the table's messages helps tests succeed consistently (possibly extra delay helps?)
@@ -127,7 +127,11 @@ export class Table extends LitElement implements LoadableComponent { | |||
* | |||
* @readonly | |||
*/ | |||
@property() selectedItems: TableRow["el"][] = []; | |||
@property() get selectedItems(): TableRow["el"][] { |
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.
TODO: clean up
ariaRowCount={this.allRows?.length} | ||
class={{ [CSS.tableFixed]: this.layout === "fixed" }} | ||
ref={(el) => { | ||
if (!el || this.tableHeadSlotEl) { |
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.
TODO: tidy up, improve naming
@@ -74,7 +74,7 @@ export class TableHeader extends LitElement implements LoadableComponent { | |||
* @notPublic | |||
*/ | |||
/** TODO: [MIGRATION] This component has been updated to use the useT9n() controller. Documentation: https://qawebgis.esri.com/arcgis-components/?path=/docs/references-t9n-for-components--docs */ | |||
messages = useT9n<typeof T9nStrings>(); | |||
messages = useT9n<typeof T9nStrings>({ blocking: true }); |
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.
Needed to block these to ensure an a11y test passes (https://dequeuniversity.com/rules/axe/4.10/empty-table-header?application=axeAPI).
packages/calcite-components/src/components/table-row/table-row.tsx
Outdated
Show resolved
Hide resolved
/> | ||
); | ||
private renderSelectableCell(): void { | ||
const cell: any = |
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.
(optional) store the reference to the element that was created on previous render and update it rather than create a new element?
that would improve re-render performance
/> | ||
); | ||
private renderNumberedCell(): void { | ||
const cell = |
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.
(optional) store the reference to the element that was created on previous render and update it rather than create a new element?
that would improve re-render performance
packages/calcite-components/src/components/table-row/table-row.tsx
Outdated
Show resolved
Hide resolved
Did you find out what was the main issue with rendering the table in parts with JSX? depending on what was the cause, you might be able to make this PR a bit more declarative by directly calling lit-html's
a limitation though: you can only render one template into some parent container at a given time using |
My guess is that the final |
Related Issue: #10495
Summary
Split up table rendering to bypass HTML parser corrections that would break functionality and styling.