Skip to content

Commit 6f103fd

Browse files
authored
chore(ssr-compiler): aria loose ends (#4735)
1 parent 2d3cd5c commit 6f103fd

File tree

2 files changed

+55
-18
lines changed

2 files changed

+55
-18
lines changed

packages/@lwc/ssr-compiler/src/compile-template/transformers/component.ts

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -90,21 +90,6 @@ function getChildAttrsOrProps(
9090
return b.objectExpression(objectAttrsOrProps);
9191
}
9292

93-
function reflectAriaPropsAsAttrs(props: IrProperty[]): IrAttribute[] {
94-
return props
95-
.map((prop) => {
96-
if (prop.attributeName.startsWith('aria-') || prop.attributeName === 'role') {
97-
return {
98-
type: 'Attribute',
99-
name: prop.attributeName,
100-
value: prop.value,
101-
} as IrAttribute;
102-
}
103-
return null;
104-
})
105-
.filter((el): el is NonNullable<IrAttribute> => el !== null);
106-
}
107-
10893
export const Component: Transformer<IrComponent> = function Component(node, cxt) {
10994
// Import the custom component's generateMarkup export.
11095
const childGeneratorLocalName = `generateMarkup_${toPropertyName(node.name)}`;
@@ -113,8 +98,6 @@ export const Component: Transformer<IrComponent> = function Component(node, cxt)
11398
cxt.hoist(componentImport, childGeneratorLocalName);
11499
const childTagName = node.name;
115100

116-
const attributes = [...node.attributes, ...reflectAriaPropsAsAttrs(node.properties)];
117-
118101
const shadowSlotContent = optimizeAdjacentYieldStmts(irChildrenToEs(node.children, cxt));
119102

120103
const lightSlotContent = node.children.map((child) => {
@@ -135,7 +118,7 @@ export const Component: Transformer<IrComponent> = function Component(node, cxt)
135118
return [
136119
bYieldFromChildGenerator(
137120
getChildAttrsOrProps(node.properties, cxt),
138-
getChildAttrsOrProps(attributes, cxt),
121+
getChildAttrsOrProps(node.attributes, cxt),
139122
shadowSlotContent,
140123
lightSlotContent,
141124
b.identifier(childGeneratorLocalName),

packages/@lwc/ssr-runtime/src/lightning-element.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,60 @@ export class LightningElement implements PropsAvailableAtConstruction {
215215
setAttributeNS(_namespace: string | null, _qualifiedName: string, _value: string): void {
216216
throw new Error('Method "setAttributeNS" not implemented.');
217217
}
218+
219+
// ARIA properties
220+
ariaActiveDescendant!: string | null;
221+
ariaAtomic!: string | null;
222+
ariaAutoComplete!: string | null;
223+
ariaBusy!: string | null;
224+
ariaChecked!: string | null;
225+
ariaColCount!: string | null;
226+
ariaColIndex!: string | null;
227+
ariaColIndexText!: string | null;
228+
ariaColSpan!: string | null;
229+
ariaControls!: string | null;
230+
ariaCurrent!: string | null;
231+
ariaDescribedBy!: string | null;
232+
ariaDescription!: string | null;
233+
ariaDetails!: string | null;
234+
ariaDisabled!: string | null;
235+
ariaErrorMessage!: string | null;
236+
ariaExpanded!: string | null;
237+
ariaFlowTo!: string | null;
238+
ariaHasPopup!: string | null;
239+
ariaHidden!: string | null;
240+
ariaInvalid!: string | null;
241+
ariaKeyShortcuts!: string | null;
242+
ariaLabel!: string | null;
243+
ariaLabelledBy!: string | null;
244+
ariaLevel!: string | null;
245+
ariaLive!: string | null;
246+
ariaModal!: string | null;
247+
ariaMultiLine!: string | null;
248+
ariaMultiSelectable!: string | null;
249+
ariaOrientation!: string | null;
250+
ariaOwns!: string | null;
251+
ariaPlaceholder!: string | null;
252+
ariaPosInSet!: string | null;
253+
ariaPressed!: string | null;
254+
ariaReadOnly!: string | null;
255+
ariaRelevant!: string | null;
256+
ariaRequired!: string | null;
257+
ariaRoleDescription!: string | null;
258+
ariaRowCount!: string | null;
259+
ariaRowIndex!: string | null;
260+
ariaRowIndexText!: string | null;
261+
ariaRowSpan!: string | null;
262+
ariaSelected!: string | null;
263+
ariaSetSize!: string | null;
264+
ariaSort!: string | null;
265+
ariaValueMax!: string | null;
266+
ariaValueMin!: string | null;
267+
ariaValueNow!: string | null;
268+
ariaValueText!: string | null;
269+
ariaBrailleLabel!: string | null;
270+
ariaBrailleRoleDescription!: string | null;
271+
role!: string | null;
218272
}
219273

220274
defineProperties(LightningElement.prototype, reflectionDescriptors);

0 commit comments

Comments
 (0)