-
Notifications
You must be signed in to change notification settings - Fork 136
[UEPR-445] Ensure topbar is navigable via tab navigation #403
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
Open
kbangelov
wants to merge
62
commits into
scratchfoundation:develop
Choose a base branch
from
kbangelov:task/uepr-445-ensure-navigable-toolbar
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
62 commits
Select commit
Hold shift + click to select a range
a2f0390
chore: initial commit - making elements focusable and react to enter
kbangelov 06d2d62
feat: added some accessability with arrow logic
kbangelov 34b18df
chore: addressed copilot stuff
kbangelov 1c05d24
feat: refactored dropdown menu logic
kbangelov 9914e61
feat: more dropdowns in new files and stuff
kbangelov 328b234
chore: completed functionality and refactored code inconsistencies
kbangelov 0c20327
chore: added aria-expanded everywhere on dropdowns
kbangelov 6f3a80d
chore: code redacting
kbangelov 05fb1da
chore: cleanup of isOpen logic for menus, since it is reimplemented
kbangelov 333f1f8
chore: adjusted key press logic to match wanted functionality
kbangelov f1ea8f6
Merge branch 'develop' into task/uepr-445-ensure-navigable-toolbar
kbangelov 2ce4eac
chore: post-merge accessibility readjustments
kbangelov fdac2f4
chore: minor code changes
kbangelov 77f2ac6
chore: translated labels and some more adjustments
kbangelov 3f518b5
chore: undeleted a line
kbangelov 83bdad7
chore: moved file
kbangelov 5640a76
chore: beginning to remove now obsolete old logic related to opening …
kbangelov 4f92988
chore: refactored menu navigation logic via a hook
kbangelov 287e1a5
chore: more refactoring
kbangelov 19fef13
chore: removed old menus logic
kbangelov d2fd053
chore: package-lock.json back to original
kbangelov 016f46f
chore: deleting rows
kbangelov d75933d
chore: refactored some menuRef, itemRef code
kbangelov e186ba9
chore: passing down remix message
kbangelov 37c9974
chore: added some isRequired-s
kbangelov fa75484
chore: brought some elements inside file menu
kbangelov 8626a1a
chore: fixed some aria labels
kbangelov 965434b
chore: context is function instead of class now
kbangelov dbaa015
chore: more refactoring and semantic improvements
kbangelov 824f352
chore: tiny bit more refactoring
kbangelov bad3449
Merge branch 'develop' into task/uepr-445-ensure-navigable-toolbar
kbangelov 8c76688
chore: fix pipeline fail
kbangelov 58b77bf
chore: fixing test
kbangelov 408f6e2
chore: package-lock.json
kbangelov c4c59b1
chore: fixed unit test
kbangelov 0ddeddb
chore: completed nav bar with all optional buttons
kbangelov 7599d05
chore: refactored code, addressed comments
kbangelov 7618f41
chore: changed accessibility messages and updated jsdoc
kbangelov a0985ea
chore: more code refactoring and comment addressing
kbangelov 3a935c4
chore: removed redundant aria-label usage
kbangelov 6864586
chore: fixing more things
kbangelov 84124af
chore: removed old unnecessary code
kbangelov 67c14ac
Merge branch 'develop' into task/uepr-445-ensure-navigable-toolbar
kbangelov 3290043
chore: restore enter functionality thorugh hook
kbangelov f80c5d7
feat: reimplemented algorithm for finding inner menus via HTML tag BFS
kbangelov 734a948
chore: fix unit tests
kbangelov f17c40f
chore: fixed integration tests
kbangelov ed3395d
Merge branch 'develop' into task/uepr-445-ensure-navigable-toolbar
kbangelov dd8b41c
chore: renamed methods
kbangelov c539ae6
chore: addressing some copilot comments
kbangelov b7ee8d9
chore: addressing comments, final pieces of refactoring
kbangelov c1d29dd
chore: improved html bfs tag logic
kbangelov e0eca58
chore: deleted obsolete code
kbangelov 6690d7e
chore: small changes - prop name and description
kbangelov 9b68c81
chore: refactor movement logic and account menu structure
kbangelov bc8dcb9
chore: refactored hook logic - switched from keeping state focusedInd…
kbangelov c4178e8
chore: moved depth as a prop for menus and separated styling into men…
kbangelov eb9e6da
chore: moved stylings to separate css file
kbangelov 3f38961
chore: fixed background bug
kbangelov 4aac3b7
chore: addressed copilot comments
kbangelov d393d77
chore: addressing code mistakes - replaced needless state, brought ba…
kbangelov 783dbaf
chore: added reverse arrow key navigation on isRtl condition to hook
kbangelov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| .about-icon { | ||
| height: 1.25rem; | ||
| margin: 0.5rem; | ||
| vertical-align: middle; | ||
| } |
134 changes: 134 additions & 0 deletions
134
packages/scratch-gui/src/components/menu-bar/about-menu.jsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,134 @@ | ||
| import React, {useCallback} from 'react'; | ||
| import PropTypes from 'prop-types'; | ||
| import classNames from 'classnames'; | ||
| import {useIntl, defineMessage} from 'react-intl'; | ||
| import {connect} from 'react-redux'; | ||
|
|
||
| import MenuBarMenu from './menu-bar-menu.jsx'; | ||
| import Button from '../button/button.jsx'; | ||
| import {MenuItem} from '../menu/menu.jsx'; | ||
| import useMenuNavigation from '../../hooks/use-menu-navigation.jsx'; | ||
|
|
||
| import stylesMenuBar from './menu-bar.css'; | ||
| import stylesAboutMenu from './about-menu.css'; | ||
| import aboutIcon from './icon--about.svg'; | ||
|
|
||
| const aboutMenuMessage = defineMessage({ | ||
| id: 'gui.aria.aboutMenu', | ||
| defaultMessage: 'About menu', | ||
| description: 'accessibility label for About menu' | ||
| }); | ||
|
|
||
| const AboutButton = props => { | ||
| const intl = useIntl(); | ||
|
|
||
| return (<Button | ||
| className={classNames(stylesMenuBar.menuBarItem, stylesMenuBar.hoverable)} | ||
| iconClassName={stylesAboutMenu.aboutIcon} | ||
kbangelov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| iconSrc={aboutIcon} | ||
| onClick={props.onClick} | ||
| aria-label={intl.formatMessage(aboutMenuMessage)} | ||
| />); | ||
| }; | ||
|
|
||
| AboutButton.propTypes = { | ||
| onClick: PropTypes.func.isRequired | ||
| }; | ||
|
|
||
| const AboutMenu = ({ | ||
| onClick, | ||
| isRtl, | ||
| depth | ||
| }) => { | ||
| if (!onClick) { | ||
| // hide the button | ||
| return null; | ||
| } | ||
| if (typeof onClick === 'function') { | ||
| // make a button which calls a function | ||
| return <AboutButton onClick={onClick} />; | ||
| } | ||
|
|
||
| // assume it's an array of objects | ||
| // each item must have a 'title' FormattedMessage and a 'handleClick' function | ||
| // generate a menu with items for each object in the array | ||
|
|
||
| const intl = useIntl(); | ||
|
|
||
| const { | ||
| menuRef, | ||
| isExpanded, | ||
| handleOnOpen, | ||
| handleOnClose, | ||
| handleKeyDown, | ||
| handleKeyDownOpenMenu | ||
| } = useMenuNavigation({ | ||
| depth, | ||
| isRtl | ||
| }); | ||
|
|
||
| const wrapAboutMenuCallback = useCallback( | ||
| callback => () => { | ||
| callback(); | ||
| handleOnClose(); | ||
| }, | ||
| [handleOnClose] | ||
| ); | ||
|
|
||
| return ( | ||
| <button | ||
| className={classNames(stylesMenuBar.menuBarItem, stylesMenuBar.hoverable, { | ||
| [stylesMenuBar.active]: isExpanded() | ||
| })} | ||
| onClick={handleOnOpen} | ||
| onKeyDown={handleKeyDown} | ||
| aria-label={intl.formatMessage(aboutMenuMessage)} | ||
| aria-expanded={isExpanded()} | ||
| ref={menuRef} | ||
| > | ||
| <img | ||
| className={stylesAboutMenu.aboutIcon} | ||
| src={aboutIcon} | ||
| /> | ||
| <MenuBarMenu | ||
| className={classNames(stylesMenuBar.menuBarMenu)} | ||
| open={isExpanded()} | ||
| place={isRtl ? 'right' : 'left'} | ||
| onRequestClose={handleOnClose} | ||
| > | ||
| { | ||
| onClick.map(itemProps => ( | ||
| <MenuItem | ||
| key={itemProps.title} | ||
| onClick={wrapAboutMenuCallback(itemProps.onClick)} | ||
| onParentKeyDown={handleKeyDownOpenMenu} | ||
| isDataMenuItem | ||
| > | ||
| {itemProps.title} | ||
| </MenuItem> | ||
| )) | ||
| } | ||
| </MenuBarMenu> | ||
| </button> | ||
| ); | ||
| }; | ||
|
|
||
| AboutMenu.propTypes = { | ||
| isRtl: PropTypes.bool, | ||
| onClick: PropTypes.oneOfType([ | ||
| PropTypes.func, // button mode: call this callback when the About button is clicked | ||
| PropTypes.arrayOf( // menu mode: list of items in the About menu | ||
| PropTypes.shape({ | ||
| title: PropTypes.string, // text for the menu item | ||
| onClick: PropTypes.func // call this callback when the menu item is clicked | ||
| }) | ||
| ) | ||
| ]), | ||
| depth: PropTypes.number | ||
| }; | ||
|
|
||
| const mapStateToProps = state => ({ | ||
| isRtl: state.locales.isRtl | ||
| }); | ||
|
|
||
| export default connect(mapStateToProps)(AboutMenu); | ||
12 changes: 12 additions & 0 deletions
12
...i/src/components/menu-bar/account-nav.css → .../src/components/menu-bar/account-menu.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.