Skip to content

Commit

Permalink
feat: add aria role attributes (#161)
Browse files Browse the repository at this point in the history
fixes #155
  • Loading branch information
Lexandrina90 authored Aug 10, 2023
1 parent eb6d108 commit 59216a6
Show file tree
Hide file tree
Showing 30 changed files with 51 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/react/components/ActionsButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const ActionsButton = forwardRef((props, ref) => {
);

return (
<Component ref={rippleElRef} className={c.base} {...attrs}>
<Component ref={rippleElRef} role="button" tabindex="0" className={c.base} {...attrs}>
{children}
</Component>
);
Expand Down
2 changes: 1 addition & 1 deletion src/react/components/BreadcrumbsCollapsed.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const BreadcrumbsCollapsed = forwardRef((props, ref) => {
);

return (
<Component ref={elRef} className={c.base} {...attrs}>
<Component ref={elRef} role="button" tabindex="0" className={c.base} {...attrs}>
<span className={c.dot} />
<span className={c.dot} />
<span className={c.dot} />
Expand Down
2 changes: 1 addition & 1 deletion src/react/components/BreadcrumbsItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const BreadcrumbsItem = forwardRef((props, ref) => {
);

return (
<Component ref={elRef} className={c.base} {...attrs}>
<Component ref={elRef} className={c.base} role="menuitem" tabindex="0" {...attrs}>
{children}
</Component>
);
Expand Down
2 changes: 2 additions & 0 deletions src/react/components/Button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ const Button = forwardRef((props, ref) => {
ref={rippleElRef}
className={classes}
disabled={disabled}
role="button"
tabindex="0"
{...attrs}
>
{children}
Expand Down
2 changes: 1 addition & 1 deletion src/react/components/Chip.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const Chip = forwardRef((props, ref) => {
{media && <div className={c.media}>{media}</div>}
{children}
{deleteButton && (
<div className={c.deleteButton} onClick={onDelete}>
<div className={c.deleteButton} role="button" tabindex="0" onClick={onDelete}>
<DeleteIcon theme={theme} className="h-4 w-4" />
</div>
)}
Expand Down
2 changes: 1 addition & 1 deletion src/react/components/DialogButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const DialogButton = forwardRef((props, ref) => {

if (theme === 'ios')
return (
<Component className={c.base} disabled={disabled} {...attrs}>
<Component className={c.base} disabled={disabled} role="button" tabindex="0" {...attrs}>
{children}
</Component>
);
Expand Down
1 change: 1 addition & 0 deletions src/react/components/Fab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const Fab = forwardRef((props, ref) => {
className={text ? c.base.withText : c.base.iconOnly}
href={href}
ref={rippleElRef}
role="button" tabindex="0"
{...attrs}
>
{text && textPosition === 'before' && (
Expand Down
2 changes: 2 additions & 0 deletions src/react/components/Link.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ const Link = forwardRef((props, ref) => {
ref={rippleElRef}
className={classes}
{...attrs}
role="link"
tabindex="0"
onClick={onClick}
>
{children}
Expand Down
4 changes: 2 additions & 2 deletions src/react/components/Notification.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const Notification = forwardRef((props, ref) => {
<div className={c.titleRightText}>{titleRightText}</div>
)}
{button && (
<div className={c.button} onClick={onClose}>
<div className={c.button} role="button" tabindex="0" onClick={onClose}>
<DeleteIcon theme={theme} className={c.deleteIcon} />
</div>
)}
Expand Down Expand Up @@ -95,7 +95,7 @@ const Notification = forwardRef((props, ref) => {
</div>
</div>
{button && (
<div className={c.button} onClick={onClose}>
<div className={c.button} role="button" tabindex="0" onClick={onClose}>
<DeleteIcon theme={theme} className={c.deleteIcon} />
</div>
)}
Expand Down
4 changes: 4 additions & 0 deletions src/react/components/Stepper.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ const Stepper = forwardRef((props, ref) => {
<span
ref={buttonLeftElRef}
className={buttonLeftClasses}
role="button"
tabindex="0"
onClick={onMinus}
>
<span className={c.hBar} />
Expand All @@ -177,6 +179,8 @@ const Stepper = forwardRef((props, ref) => {
<span
ref={buttonRightElRef}
className={buttonRightClasses}
role="button"
tabindex="0"
onClick={onPlus}
>
<span className={c.hBar} />
Expand Down
2 changes: 2 additions & 0 deletions src/svelte/components/ActionsButton.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
this={Component}
bind:this={rippleEl.current}
class={c.base}
role="button"
tabindex="0"
on:click={onClick}
{...attrs}
>
Expand Down
2 changes: 1 addition & 1 deletion src/svelte/components/BreadcrumbsCollapsed.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
);
</script>

<div class={c.base} {...$$restProps} on:click={onClick}>
<div class={c.base} {...$$restProps} role="button" tabindex="0" on:click={onClick}>
<span class={c.dot} />
<span class={c.dot} />
<span class={c.dot} />
Expand Down
2 changes: 1 addition & 1 deletion src/svelte/components/BreadcrumbsItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
);
</script>

<div class={c.base} {...$$restProps} on:click={onClick}>
<div class={c.base} {...$$restProps} role="menuitem" tabindex="0" on:click={onClick}>
<slot />
</div>
2 changes: 2 additions & 0 deletions src/svelte/components/Button.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@
class={classes}
{disabled}
{...attrs}
role="button"
tabindex="0"
on:click={onClick}
>
<slot />
Expand Down
2 changes: 1 addition & 1 deletion src/svelte/components/Chip.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
{/if}
<slot />
{#if deleteButton}
<div class={c.deleteButton} on:click={onDelete}>
<div class={c.deleteButton} role="button" tabindex="0" on:click={onDelete}>
<DeleteIcon {theme} class="h-4 w-4" />
</div>
{/if}
Expand Down
2 changes: 2 additions & 0 deletions src/svelte/components/DialogButton.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
class={c.base}
{disabled}
{...attrs}
role="button"
tabindex="0"
on:click={onClick}
>
<slot />
Expand Down
2 changes: 2 additions & 0 deletions src/svelte/components/Fab.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
class={text ? c.base.withText : c.base.iconOnly}
{href}
bind:this={rippleEl.current}
role="button"
tabindex="0"
on:click={onClick}
{...$$restProps}
>
Expand Down
2 changes: 2 additions & 0 deletions src/svelte/components/Link.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@
class={classes}
{...$$restProps}
{...linkProps}
role="link"
tabindex="0"
on:click={onClick}
>
<slot />
Expand Down
4 changes: 2 additions & 2 deletions src/svelte/components/Notification.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
</div>
{/if}
{#if button || $$slots.button}
<div class={c.button} on:click={onClose}>
<div class={c.button} role="button" tabindex="0" on:click={onClose}>
<DeleteIcon {theme} class={c.deleteIcon} />
<slot name="button" />
</div>
Expand Down Expand Up @@ -103,7 +103,7 @@
</div>
</div>
{#if button || $$slots.button}
<div class={c.button} on:click={onClose}>
<div class={c.button} role="button" tabindex="0" on:click={onClose}>
<DeleteIcon {theme} class={c.deleteIcon} />
<slot name="button" />
</div>
Expand Down
4 changes: 4 additions & 0 deletions src/svelte/components/Stepper.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@
<span
bind:this={buttonLeftEl.current}
class={buttonLeftClasses}
role="button"
tabindex="0"
on:click={onMinus}
>
<span class={c.hBar} />
Expand All @@ -155,6 +157,8 @@
<span
bind:this={buttonRightEl.current}
class={buttonRightClasses}
role="button"
tabindex="0"
on:click={onPlus}
>
<span class={c.hBar} />
Expand Down
2 changes: 1 addition & 1 deletion src/vue/components/ActionsButton.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<component :is="Component" ref="rippleElRef" :class="c.base">
<component :is="Component" ref="rippleElRef" role="button" tabindex="0" :class="c.base">
<slot />
</component>
</template>
Expand Down
2 changes: 1 addition & 1 deletion src/vue/components/BreadcrumbsCollapsed.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<component :is="component" :class="c.base">
<component :is="component" :class="c.base" role="button" tabindex="0" >
<span :class="c.dot" />
<span :class="c.dot" />
<span :class="c.dot" />
Expand Down
2 changes: 1 addition & 1 deletion src/vue/components/BreadcrumbsItem.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<component :is="component" :class="c.base">
<component :is="component" :class="c.base" role="menuitem" tabindex="0">
<slot />
</component>
</template>
Expand Down
2 changes: 2 additions & 0 deletions src/vue/components/Button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
ref="rippleElRef"
:class="classes"
:disabled="disabled"
role="button"
tabindex="0"
>
<slot />
</component>
Expand Down
2 changes: 1 addition & 1 deletion src/vue/components/Chip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<component :is="component" :class="c.base[style]">
<div v-if="slots.media" :class="c.media"><slot name="media" /></div>
<slot />
<div v-if="deleteButton" :class="c.deleteButton" @click="onDelete">
<div v-if="deleteButton" :class="c.deleteButton" role="button" tabindex="0" @click="onDelete">
<delete-icon :theme="theme" class="h-4 w-4" />
</div>
</component>
Expand Down
2 changes: 2 additions & 0 deletions src/vue/components/DialogButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
ref="rippleElRef"
:class="c.base"
:disabled="disabled"
role="button"
tabindex="0"
>
<slot />
</component>
Expand Down
2 changes: 2 additions & 0 deletions src/vue/components/Fab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
:is="component"
ref="rippleElRef"
:class="text || slots.text ? c.base.withText : c.base.iconOnly"
role="button"
tabindex="0"
:href="href"
>
<span
Expand Down
2 changes: 2 additions & 0 deletions src/vue/components/Link.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
ref="rippleElRef"
:class="classes"
v-bind="linkProps"
role="link"
tabindex="0"
>
<slot />
</component>
Expand Down
4 changes: 2 additions & 2 deletions src/vue/components/Notification.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
>
{{ titleRightText }}<slot name="titleRightText" />
</div>
<div v-if="button || slots.button" :class="c.button" @click="onClose">
<div v-if="button || slots.button" :class="c.button" role="button" tabindex="0" @click="onClose">
<delete-icon :theme="theme" :class="c.deleteIcon" />
<slot name="button" />
</div>
Expand Down Expand Up @@ -55,7 +55,7 @@
<slot />
</div>
</div>
<div v-if="button || slots.button" :class="c.button" @click="onClose">
<div v-if="button || slots.button" :class="c.button" role="button" tabindex="0" @click="onClose">
<delete-icon :theme="theme" :class="c.deleteIcon" />
<slot name="button" />
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/vue/components/Stepper.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<component :is="component" :class="classes">
<span ref="buttonLeftElRef" :class="buttonLeftClasses" @click="onMinus">
<span ref="buttonLeftElRef" :class="buttonLeftClasses" role="button" tabindex="0" @click="onMinus">
<span :class="c.hBar" />
</span>
<input
Expand All @@ -18,7 +18,7 @@
/>
<span v-if="!input && !buttonsOnly" :class="valueClasses">{{ value }}</span>

<span ref="buttonRightElRef" :class="buttonRightClasses" @click="onPlus">
<span ref="buttonRightElRef" :class="buttonRightClasses" role="button" tabindex="0" @click="onPlus">
<span :class="c.hBar" />
<span :class="c.vBar" />
</span>
Expand Down

0 comments on commit 59216a6

Please sign in to comment.