Skip to content

Commit

Permalink
Fix #839: ARIA fixes (#3349)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Sep 21, 2022
1 parent 9b3fbf7 commit 009c0fb
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion components/lib/button/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,6 @@ Button.defaultProps = {
tooltipOptions: null,
disabled: false,
loading: false,
loadingIcon: 'pi pi-spinner pi-spin'
loadingIcon: 'pi pi-spinner pi-spin',
visible: true
};
2 changes: 1 addition & 1 deletion components/lib/datatable/BodyCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ export const BodyCell = React.memo((props) => {
};

content = (
<Button className={expanderProps.className} onClick={expanderProps.onClick} type="button" icon={expanderProps.iconClassName} aria-expanded={props.expanded} aria-controls={ariaControls} tabIndex={props.tabIndex} ariaLabel={label} />
<Button className={expanderProps.className} onClick={expanderProps.onClick} type="button" icon={expanderProps.iconClassName} aria-expanded={props.expanded} aria-controls={ariaControls} tabIndex={props.tabIndex} aria-label={label} />
);

if (body) {
Expand Down
2 changes: 1 addition & 1 deletion components/lib/datatable/RowTogglerButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const RowTogglerButton = React.memo((props) => {
const iconClassName = classNames('p-row-toggler-icon', props.expanded ? props.expandedRowIcon : props.collapsedRowIcon);
const label = props.expanded ? ariaLabel('collapseLabel') : ariaLabel('expandLabel');

return <Button className="p-row-toggler p-link" onClick={onClick} type="button" icon={iconClassName} tabIndex={props.tabIndex} ariaLabel={label} />;
return <Button className="p-row-toggler p-link" onClick={onClick} type="button" icon={iconClassName} tabIndex={props.tabIndex} aria-label={label} />;
});

RowTogglerButton.displayName = 'RowTogglerButton';
2 changes: 1 addition & 1 deletion components/lib/inplace/Inplace.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const Inplace = React.forwardRef((props, ref) => {

const createCloseButton = () => {
if (props.closable) {
return <Button type="button" className="p-inplace-content-close" icon="pi pi-times" onClick={close} ariaLabel={localeOption('close')} />;
return <Button type="button" className="p-inplace-content-close" icon="pi pi-times" onClick={close} aria-label={localeOption('close')} />;
}

return null;
Expand Down
2 changes: 1 addition & 1 deletion components/lib/tree/UITreeNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ export const UITreeNode = React.memo((props) => {
const createToggler = () => {
const label = expanded ? ariaLabel('collapseLabel') : ariaLabel('expandLabel');
const iconClassName = classNames('p-tree-toggler-icon pi pi-fw', { 'pi-chevron-right': !expanded, 'pi-chevron-down': expanded });
let content = <Button type="button" className="p-tree-toggler p-link" tabIndex={-1} onClick={onTogglerClick} icon={iconClassName} ariaLabel={label} />;
let content = <Button type="button" className="p-tree-toggler p-link" tabIndex={-1} onClick={onTogglerClick} icon={iconClassName} aria-label={label} />;

if (props.togglerTemplate) {
const defaultContentOptions = {
Expand Down
2 changes: 1 addition & 1 deletion components/lib/treetable/TreeTableRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ export const TreeTableRow = React.memo((props) => {
const iconClassName = classNames('p-treetable-toggler-icon pi pi-fw', { 'pi-chevron-right': !expanded, 'pi-chevron-down': expanded });
const style = { marginLeft: props.level * 16 + 'px', visibility: props.node.leaf === false || (props.node.children && props.node.children.length) ? 'visible' : 'hidden' };

return <Button type="button" className="p-treetable-toggler p-link p-unselectable-text" style={style} tabIndex={-1} onClick={onTogglerClick} icon={iconClassName} ariaLabel={label} />;
return <Button type="button" className="p-treetable-toggler p-link p-unselectable-text" style={style} tabIndex={-1} onClick={onTogglerClick} icon={iconClassName} aria-label={label} />;
};

const createCheckbox = () => {
Expand Down

0 comments on commit 009c0fb

Please sign in to comment.