Skip to content

Commit

Permalink
Enhance error list rendering: add smooth scroll and focus behavior fo…
Browse files Browse the repository at this point in the history
…r improved accessibility

Refs: #7323
  • Loading branch information
deleonio committed Jan 29, 2025
1 parent 34351ef commit a5fd7ea
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/components/src/components/form/shadow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,19 @@ export class KolForm implements FormAPI {

private renderErrorList(errorList?: ErrorListPropType[]): JSX.Element {
return (
<KolAlertFc type="error" variant="card" label={translate('kol-error-list-message')}>
<KolAlertFc
ref={(el) => {
setTimeout(() => {
if (el && typeof el.focus === 'function') {
el.scrollIntoView({ behavior: 'smooth' });
el.focus();
}
}, 250);
}}
type="error"
variant="card"
label={translate('kol-error-list-message')}
>
<nav aria-label={translate('kol-error-list')}>
<ul>
{errorList?.map((error, index) => (
Expand Down

0 comments on commit a5fd7ea

Please sign in to comment.