Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix keyboard navigation #375

Merged
merged 4 commits into from
Mar 3, 2023
Merged
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

### Fixed

- Fix keyboard navigation (#375)
chrisruk marked this conversation as resolved.
Show resolved Hide resolved

## [0.13.0] - 2023-03-02

### Added
Expand Down
12 changes: 6 additions & 6 deletions src/components/Editor/FontSizeSelector/FontSizeSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ const FontSizeSelector = () => {
return (
<div className='font-size-selector'>
<div className='font-btn font-btn--small' onClick={() => setFontSize('small')}>
<div className={`font-btn__icon font-btn__icon--small ${fontSize==='small' ? 'font-btn__icon--active' : ''}`}>
<button className={`font-btn__icon font-btn__icon--small ${fontSize==='small' ? 'font-btn__icon--active' : ''}`}>
<FontIcon size={15}/>
</div>
</button>
<p>{t('header.settingsMenu.textSizeOptions.small')}</p>
</div>
<div className='font-btn font-btn--medium' onClick={() => setFontSize('medium')}>
<div className={`font-btn__icon font-btn__icon--medium ${fontSize==='medium' ? 'font-btn__icon--active' : ''}`}>
<button className={`font-btn__icon font-btn__icon--medium ${fontSize==='medium' ? 'font-btn__icon--active' : ''}`}>
<FontIcon size={23}/>
</div>
</button>
<p>{t('header.settingsMenu.textSizeOptions.medium')}</p>
</div>
<div className='font-btn font-btn--large' onClick={() => setFontSize('large')}>
<div className={`font-btn__icon font-btn__icon--large ${fontSize==='large' ? 'font-btn__icon--active' : ''}`}>
<button className={`font-btn__icon font-btn__icon--large ${fontSize==='large' ? 'font-btn__icon--active' : ''}`}>
<FontIcon size={36}/>
</div>
</button>
<p>{t('header.settingsMenu.textSizeOptions.large')}</p>
</div>
</div>
Expand Down
8 changes: 7 additions & 1 deletion src/components/Menus/Dropdown/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,14 @@ const Dropdown = (props) => {
};
}, [dropdown]);

const handleKeyDown = (event) => {
if (event.key === 'Escape'){
setOpen(false);
}
}

return (
<div className='dropdown' ref={dropdown}>
<div className='dropdown' ref={dropdown} onKeyDown={handleKeyDown}>
<Button
className={`btn--tertiary dropdown-button${isOpen ? ' dropdown-button--active' : ''}`}
onClickHandler={() => setOpen(!isOpen)}
Expand Down
3 changes: 2 additions & 1 deletion src/components/Menus/SettingsMenu/SettingsMenu.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from "react";

import FontSizeSelector from "../../Editor/FontSizeSelector/FontSizeSelector";
import ThemeToggle from "../../ThemeToggle/ThemeToggle";
import './SettingsMenu.scss'
Expand All @@ -7,7 +8,7 @@ import { useTranslation } from 'react-i18next';
const SettingsMenu = () => {

const {t} = useTranslation()

return (
<div className='dropdown-container dropdown-container--bottom settings-menu'>
<h2>{t('header.settingsMenu.heading')}</h2>
Expand Down
8 changes: 4 additions & 4 deletions src/components/ThemeToggle/ThemeToggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ const ThemeToggle = () => {
return (
<div className='theme-toggle'>
<div className='theme-btn theme-btn--light' onClick={() => setTheme('light')}>
<div className={`theme-btn__icon theme-btn__icon--light ${!isDarkMode ? 'theme-btn__icon--active' : null}`}>
<button className={`theme-btn__icon theme-btn__icon--light ${!isDarkMode ? 'theme-btn__icon--active' : null}`}>
<SunIcon />
</div>
</button>
<p>{t('header.settingsMenu.themeOptions.light')}</p>
</div>
<div className='theme-btn theme-btn--dark' onClick={() => setTheme('dark')}>
<div className={`theme-btn__icon theme-btn__icon--dark ${isDarkMode ? 'theme-btn__icon--active' : null}`}>
<button className={`theme-btn__icon theme-btn__icon--dark ${isDarkMode ? 'theme-btn__icon--active' : null}`}>
<MoonIcon />
</div>
</button>
<p>{t('header.settingsMenu.themeOptions.dark')}</p>
</div>
</div>
Expand Down