Update to de menu fix#1504
Open
dpvc wants to merge 5 commits into
Open
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR implements a number of adjustments to the menu localization code, including:
As part of (3) I have added a conversion from the old to new IDs for the few that could not be returned to their originals. These included ones that included spaces (which we removed), and a few others that needed updating.
Details
The a11y component files are removed from
components/mjs, since there is no longer an actual component being created.The explorer and menu configurations now copy the aria localization files (since both components use them and copying them twice doesn't really hurt).
The ts/a11y/aria.ts file is no longer needed, so is removed.
The
a11y/__locales__directory is moved toa11y/aria/__locales__for the new fakea11y/ariacomponent, and theComponent.tsfile is modified accordingly. It now loads theenlocale data (rathe than doing the in a separateen.jsfile in the component, since there is not component, and we are going to move the rest of theen.jscomponent files into their respectiveComponent.jsfiles in a future PR anyway). TheComponent.tsfile now also exports aroleDescPrefixconstant that gives the prefix for the aria role description values (this is used in the explorer and menu code as we will see below).In
explorer.ts, since the values of the radio group variables are now the un-prefixed values (as they were originally), the initial value is changed back to'math'and the check for "none" is for the value'none'. There is no longer a need for theAriaRoleDescriptionobject, since the prefixes are not part of the data any longer. Instead, we add theroleDescPrefixat the time the role description is being localized.A small change in
KeyExplorer.tsprevents a comma from being added to the speech string when there is no description.In
MJContextMenu.ts, the main change is to thefindID()function in order to allow it to locate the menu items via either their un-prefixed or fully prefixed keys. This is done by testing the name against the id and the id with prefixes removed. We also have a remapping feature that translates the old keys to the new ones in the few cases where they now differ. If you think this is overkill, the remapping can be removed. I suspect that there are not may instances of people using these to adjust the menus, but I have provided some people with examples of how to do this, so there might be.With the new
findID(), the calls to this can have their prefixes removed (and the original shorter IDs used again).In
Menu.ts, the a11y/aria component data is loaded asAria, and the original role description values are used. Some localization ids are changed back to their original keys (now that they are prefixed, they no longer conflict, which was why I changed them in the original menu localization PR).The
radioGroup()andradio()functions now have a new argument that gives the prefix to use for its values. This means you don't have to include the prefix in each menu entry bub hand, and shorten the strings used to define the menu items. If this prefix is the empty string, no prefix is added. If it is'.', then the value is used un-localized as the content (e.g., for the precent strings, and for the renderer names). If the prefix is the aria role description prefix, the aria localization is used.Finally, I added prefixes to some additional menu items, since that seemed to be more consistent, and helped get some other keys to be able to use their original ids again. There are still a few un-prefixed items that could get prefixes if we wanted to be more consistent yet.
In
MenuUtil.js, I removed a dot from a prefix since those are no longer used.The ids were changed in the localization files, and the files were sorted again.