Skip to content

Commit

Permalink
fix: issues from PR
Browse files Browse the repository at this point in the history
  • Loading branch information
nmerget committed Jul 5, 2024
1 parent 9402d66 commit a7cc66f
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 28 deletions.
4 changes: 4 additions & 0 deletions packages/components/scripts/post-build/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ export const getComponents = (): Component[] => [
{
from: 'scrollContainer = null;',
to: 'scrollContainer: Element | null = null;'
},
{
from: '& > .db-tab-panel',
to: '& > dbtabpanel > .db-tab-panel, & > db-tab-panel > .db-tab-panel'
}
]
}
Expand Down
4 changes: 3 additions & 1 deletion packages/components/scripts/post-build/vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ export default (tmp?: boolean) => {
}
];

// This is a workaround for valid/invalidMessages resetting values
/* This is a workaround for valid/invalid Messages.
* If a valid/invalid message appears it will use the old this._value,
* so we need to overwrite this._value with the current event.target.value. */
[
'HTMLSelectElement',
'HTMLInputElement',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default function DBCheckbox(props: DBCheckboxProps) {
}
handleFrameworkEvent(this, event, 'checked');

/* For a11y reasons we need to map the correct message with the checkbox */
if (!ref?.validity.valid || props.customValidity === 'invalid') {
state._descByIds = state._invalidMessageId;
} else if (
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/components/input/input.lite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export default function DBInput(props: DBInputProps) {

handleFrameworkEvent(this, event);

/* For a11y reasons we need to map the correct message with the input */
if (!ref?.validity.valid || props.customValidity === 'invalid') {
state._descByIds = state._invalidMessageId;
} else if (
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/components/select/select.lite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export default function DBSelect(props: DBSelectProps) {

handleFrameworkEvent(this, event);

/* For a11y reasons we need to map the correct message with the select */
if (!ref?.validity.valid || props.customValidity === 'invalid') {
state._descByIds = state._invalidMessageId;
} else if (
Expand Down
32 changes: 12 additions & 20 deletions packages/components/src/components/tabs/tabs.lite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,27 +122,19 @@ export default function DBTabs(props: DBTabsProps) {
);
}

const tabPanels = [
...Array.from<Element>(
ref.querySelectorAll('& > .db-tab-panel')
),
...Array.from<Element>(
ref.querySelectorAll('& > dbtabpanel > .db-tab-panel')
),
...Array.from<Element>(
ref.querySelectorAll('& > db-tab-panel > .db-tab-panel')
)
];
const tabPanels = Array.from<Element>(
ref.querySelectorAll('& > .db-tab-panel')
);
if (tabPanels?.length > 0) {
tabPanels.forEach((panel: Element, index: number) => {
if (!panel.id) {
panel.id = `${state._name}-tab-panel-${index}`;
panel.setAttribute(
'aria-labelledby',
`${state._name}-tab-${index}`
);
}
});
for (const panel of tabPanels) {
if (panel.id) continue;
const index: number = tabPanels.indexOf(panel);
panel.id = `${state._name}-tab-panel-${index}`;
panel.setAttribute(
'aria-labelledby',
`${state._name}-tab-${index}`
);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export default function DBTextarea(props: DBTextareaProps) {

handleFrameworkEvent(this, event);

/* For a11y reasons we need to map the correct message with the textarea */
if (!ref?.validity.valid || props.customValidity === 'invalid') {
state._descByIds = state._invalidMessageId;
} else if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ <h1>Output</h1>
</db-tab-item>
<db-tab-item icon="airplane" [noText]="true"></db-tab-item>
</db-tab-list>
<DBTabPanel>
<db-tab-panel>
It is a long established fact that a reader will be
distracted by the readable content of a page when looking at
its layout. The point of using Lorem Ipsum is that it has a
Expand All @@ -281,10 +281,10 @@ <h1>Output</h1>
sites still in their infancy. Various versions have evolved
over the years, sometimes by accident, sometimes on purpose
(injected humour and the like).
</DBTabPanel>
<DBTabPanel>Tab Panel 2</DBTabPanel>
<DBTabPanel>Tab Panel 3</DBTabPanel>
<DBTabPanel>
</db-tab-panel>
<db-tab-panel>Tab Panel 2</db-tab-panel>
<db-tab-panel>Tab Panel 3</db-tab-panel>
<db-tab-panel>
At vero eos et accusamus et iusto odio dignissimos ducimus
qui blanditiis praesentium voluptatum deleniti atque
corrupti quos dolores et quas molestias excepturi sint
Expand Down Expand Up @@ -318,8 +318,8 @@ <h1>Output</h1>
principle of selection: he rejects pleasures to secure other
greater pleasures, or else he endures pains to avoid worse
pains.
</DBTabPanel>
<DBTabPanel>Tab Panel 5</DBTabPanel>
</db-tab-panel>
<db-tab-panel>Tab Panel 5</db-tab-panel>
</db-tabs>
</dl>
</div>
Expand Down

0 comments on commit a7cc66f

Please sign in to comment.