Skip to content

Can the ChangeHistory component adjust the label rendering logic or the passed value? #9114

Description

@btea

Enter your suggestions in details:

If the label is passed a string, then both aria-label and the content rendered by the div will be plain strings. The special Markdown formatting within the div will not be rendered correctly. If the label is passed a JSX object, the div will render correctly, but the aria-label attribute will display [object Object].

export type HistoryChange = {
versions: Array<string>;
label: string;
url?: string;
};
type ChangeHistoryProps = ComponentProps<'div'> & {
label: string;
changes: Array<HistoryChange>;
as?: LinkLike;
};

<MenuItem
key={change.label}
className={styles.dropdownItem}
role="menuitem"
tabIndex={0}
aria-label={`${change.label}: ${change.versions.join(', ')}`}
href={change.url}
>
<div className={styles.dropdownLabel}>{change.label}</div>
<div className={styles.dropdownVersions}>
{change.versions.join(', ')}
</div>
</MenuItem>

The doc-kit previously fixed the aria-label rendering issue using nodejs/doc-kit#1034. However, it wasn't completely resolved; currently, Markdown formatting is not rendered correctly within divs.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions