-
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(components): reduce post-migration TypeScript errors #10356
Conversation
@@ -764,10 +761,6 @@ export class Dialog | |||
} | |||
} | |||
|
|||
private setContainerEl = (el: HTMLDivElement): void => { |
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.
Never read, thus removed
@@ -774,9 +774,9 @@ export class InputDatePicker | |||
|
|||
@State() private localeData: DateLocaleData; | |||
|
|||
private startInput: HTMLCalciteInputElement; | |||
private startInput: HTMLCalciteInputTextElement; |
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.
This was causing a type error in Lumina - the ref is assigned to calcite-input-text, but the type here was calcite-input.
packages/calcite-components/src/components/input-number/input-number.tsx
Outdated
Show resolved
Hide resolved
@@ -146,8 +146,6 @@ export class Tooltip implements FloatingUIComponent, OpenCloseComponent { | |||
|
|||
guid = `calcite-tooltip-${guid()}`; | |||
|
|||
hasLoaded = false; |
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.
never read
@@ -228,7 +228,7 @@ export class CalciteMenu implements LocalizedComponent, T9nComponent, LoadableCo | |||
} | |||
|
|||
private getEffectiveRole(): string { | |||
return this.el.getAttribute("role") || "menubar"; |
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.
equivalent
I think Firefox ESR prevents us from using ARIA-related properties (e.g., @dasa does this seem accurate to you? Sidebar: noticed |
We're planning to only support ESR 128 in our next release: https://whattrainisitnow.com/release/?version=esr |
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.
Thanks for the PR, @maxpatiiuk!
Along the same lines of #10352, since some additional refactors were made to files unrelated to simplifying reflected attribute accesses, can you either:
- separate non-Host-related refactors to a separate PR?
- update the PR title to convey all PR changes?
Thanks!
Thanks for chiming in, @dasa! |
@jcfranco so if the next release of JS API will drop Firefox 115 ESR support, is Calcite going to do the same for Calcite 3.0 release? |
`Tag` and `childElType` are the same in Stencil, but will be different in Lit - so we should use `childElType` in places where the string check is needed.
2305e01
to
a73a79d
Compare
@@ -17,7 +17,7 @@ export const Heading: FunctionalComponent<HeadingProps> = (props, children): VNo | |||
delete props.level; | |||
|
|||
return ( | |||
<HeadingTag class={props.class} key={props.key} level={props.level}> |
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.
level
prop doesn't seem to exist in the DOM?
was it used for styling or testing? if not, we should remove it
original discussion in #10352 (comment)
@@ -114,15 +114,19 @@ export class Link implements InteractiveComponent, LoadableComponent { | |||
This works around that issue for now. | |||
*/ | |||
download={ | |||
Tag === "a" ? (download === true || download === "" ? "" : download || null) : null | |||
childElType === "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.
As per line 103 in this file (const Tag = childElType;
), Tag and childElType variables have the same value in Stencil - thus this change should have no runtime impact.
However, in Lit, Tag
function has a bit different type to comply with Lit's dynamic tag name syntax.
See Lumina's docs on JSX -> Dynamic tag names for more details
Sorry for not clarifying earlier. We should be good to use ARIA properties. |
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 stuff, @maxpatiiuk! Thanks! 🚀
…tracking * origin/dev: (40 commits) feat: add parcel parameter (#10384) feat(alert): apply --calcite-alert-corner-radius to internal close button (#10388) feat(dialog, panel): Add css properties for background-color (#10387) fix: remove aria-disabled from components where necessary (#10374) feat(action-group, block, panel): add `menuPlacement` and `menuFlipPlacements` properties (#10249) fix(list, filter): fix sync between list items and filtered data (#10342) feat(popover): apply component tokens to arrow (#10386) feat(list-item): add `unavailable` property (#10377) fix(segmented-control): honor appearance, layout and scale when items are added after initialization (#10368) fix(action-pad): fix horizontal action group alignment (#10359) fix(combobox): selection-mode="single-persist" correctly selects an item when items have same values (#10366) fix(input-time-zone): fix region mode labeling and value mapping (#10345) fix(dropdown): open dropdown on `ArrowDown` & `ArrowUp` keys (#10264) refactor(components): reduce post-migration TypeScript errors (#10356) refactor: do not use Host in functional components (#10352) refactor(tests): reduce TypeScript errors (#10344) feat(alert): add component tokens (#10218) fix(card): properly handle slotted elements (#10378) refactor(panel): remove duplicate tailwind class (#10379) feat(popover, action): add component tokens (#10253) ...
…estone-estimates * origin/dev: (29 commits) fix(input-time-zone): fix region mode labeling and value mapping (#10345) fix(dropdown): open dropdown on `ArrowDown` & `ArrowUp` keys (#10264) refactor(components): reduce post-migration TypeScript errors (#10356) refactor: do not use Host in functional components (#10352) refactor(tests): reduce TypeScript errors (#10344) feat(alert): add component tokens (#10218) fix(card): properly handle slotted elements (#10378) refactor(panel): remove duplicate tailwind class (#10379) feat(popover, action): add component tokens (#10253) chore(t9n): add translations (#10339) feat: add 3d building, 3d building parameter, divide, parcel, spaces, spaces parameter, square brackets x, n variable, zoning parameter (#10373) build: update browserslist db (#10370) ci: resolve husky pre-push and pre-commit errors (#10365) docs: update component READMEs (#10371) feat(text-area): add component tokens (#10343) fix(action): prefer `disabled` in favor of `aria-disabled` (#10367) docs(a11y): add reference to a11y guidance to issue template (#10372) chore(action): add new string for accessible indicator label (#10360) feat(chip): add component tokens (#10179) feat(avatar): add component tokens (#10280) ...
Minor refactor - some HTML attributes are reflected to properties.
Thus, we can access properties instead of calling getAttribute/hasAttribute.
Properties are also more type-safe (where as getAttribute string parameter does not have type-checking)
And other minor changes.