Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,99 +35,141 @@ exports[`components/emoji_picker/EmojiPicker should match snapshot 1`] = `
<div />
</div>
<div
aria-orientation="horizontal"
class="emoji-picker__categories"
id="emojiPickerCategories"
role="tablist"
>
<a
<button
aria-controls="emojipickercat-smileys-emotion"
aria-label="Smileys & Emotion"
class="emoji-picker__category emoji-picker__category--selected"
href="#"
aria-selected="true"
class="style--none emoji-picker__category emoji-picker__category--selected"
id="emojiPickerCategoryTab-smileys-emotion"
role="tab"
type="button"
>
<i
class="icon-emoticon-happy-outline"
/>
</a>
<a
</button>
<button
aria-controls="emojipickercat-people-body"
aria-label="People & Body"
class="emoji-picker__category"
href="#"
aria-selected="false"
class="style--none emoji-picker__category"
id="emojiPickerCategoryTab-people-body"
role="tab"
type="button"
>
<i
class="icon-account-outline"
/>
</a>
<a
</button>
<button
aria-controls="emojipickercat-animals-nature"
aria-label="Animals & Nature"
class="emoji-picker__category"
href="#"
aria-selected="false"
class="style--none emoji-picker__category"
id="emojiPickerCategoryTab-animals-nature"
role="tab"
type="button"
>
<i
class="icon-leaf-outline"
/>
</a>
<a
</button>
<button
aria-controls="emojipickercat-food-drink"
aria-label="Food & Drink"
class="emoji-picker__category"
href="#"
aria-selected="false"
class="style--none emoji-picker__category"
id="emojiPickerCategoryTab-food-drink"
role="tab"
type="button"
>
<i
class="icon-food-apple"
/>
</a>
<a
</button>
<button
aria-controls="emojipickercat-travel-places"
aria-label="Travel & Places"
class="emoji-picker__category"
href="#"
aria-selected="false"
class="style--none emoji-picker__category"
id="emojiPickerCategoryTab-travel-places"
role="tab"
type="button"
>
<i
class="icon-airplane-variant"
/>
</a>
<a
</button>
<button
aria-controls="emojipickercat-activities"
aria-label="Activities"
class="emoji-picker__category"
href="#"
aria-selected="false"
class="style--none emoji-picker__category"
id="emojiPickerCategoryTab-activities"
role="tab"
type="button"
>
<i
class="icon-basketball"
/>
</a>
<a
</button>
<button
aria-controls="emojipickercat-objects"
aria-label="Objects"
class="emoji-picker__category"
href="#"
aria-selected="false"
class="style--none emoji-picker__category"
id="emojiPickerCategoryTab-objects"
role="tab"
type="button"
>
<i
class="icon-lightbulb-outline"
/>
</a>
<a
</button>
<button
aria-controls="emojipickercat-symbols"
aria-label="Symbols"
class="emoji-picker__category"
href="#"
aria-selected="false"
class="style--none emoji-picker__category"
id="emojiPickerCategoryTab-symbols"
role="tab"
type="button"
>
<i
class="icon-heart-outline"
/>
</a>
<a
</button>
<button
aria-controls="emojipickercat-flags"
aria-label="Flags"
class="emoji-picker__category"
href="#"
aria-selected="false"
class="style--none emoji-picker__category"
id="emojiPickerCategoryTab-flags"
role="tab"
type="button"
>
<i
class="icon-flag-outline"
/>
</a>
<a
</button>
<button
aria-controls="emojipickercat-custom"
aria-label="Custom"
class="emoji-picker__category"
href="#"
aria-selected="false"
class="style--none emoji-picker__category"
id="emojiPickerCategoryTab-custom"
role="tab"
type="button"
>
<i
class="icon-emoticon-custom-outline"
/>
</a>
</button>
</div>
<div
class="emoji-picker__items"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@

exports[`EmojiPickerCategory should match snapshot 1`] = `
<DocumentFragment>
<a
<button
aria-controls="emojipickercat-recent"
aria-label="category name"
class="emoji-picker__category"
href="#"
aria-selected="false"
class="style--none emoji-picker__category"
id="emojiPickerCategoryTab-recent"
role="tab"
type="button"
>
<i
class="categoryClass"
/>
</a>
</button>
</DocumentFragment>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ function EmojiPickerCategories({
id='emojiPickerCategories'
className='emoji-picker__categories'
onKeyDown={handleKeyDown}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aria-orientation missing

role='tablist'
aria-orientation='horizontal'
>
{categoryNames.map((categoryName) => {
const category = categories[categoryName];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ describe('EmojiPickerCategory', () => {
renderWithContext(<EmojiPickerCategory {...props}/>);

// TODO: Change when we actually disabled the element when enable is false
expect(screen.getByRole('link')).toHaveClass('emoji-picker__category disable');
expect(screen.getByRole('tab')).toHaveClass('emoji-picker__category disable');
});

test('should have tooltip on hover', async () => {
renderWithContext(<EmojiPickerCategory {...defaultProps}/>);

await act(async () => {
const emojiPickerCategory = screen.getByRole('link');
const emojiPickerCategory = screen.getByRole('tab');
userEvent.hover(emojiPickerCategory);
await new Promise((resolve) => setTimeout(resolve, 1000));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,18 @@ function EmojiPickerCategory({category, categoryRowIndex, selected, enable, onCl
<FormattedMessage {...category.label}/>
}
>
<a
className={className}
href='#'
<button
role='tab'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
role='tab'
role='tab'
type='button'

type='button'
aria-selected={selected}
className={classNames('style--none', className)}
id={`emojiPickerCategoryTab-${category.name}`}
onClick={handleClick}
aria-controls={`emojipickercat-${category.name}`}
aria-label={intl.formatMessage(category.label)}
>
<i className={category.iconClassName}/>
</a>
</button>
</WithTooltip>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ function EmojiPickerCategoryRow({categoryName, style}: Props) {
<div
className='emoji-picker__category-header'
id={`emojipickercat-${categoryName}`}
aria-labelledby={`emojiPickerCategoryTab-${categoryName}`}
role='tabpanel'
>
<FormattedMessage id={`emoji_picker.${categoryName}`}/>
</div>
Expand Down