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

feat(toggle): Show all landmarks keyboard shortcut #245

Merged
merged 28 commits into from Jan 11, 2019

Conversation

matatk
Copy link
Owner

@matatk matatk commented Jan 11, 2019

Naughty! This really should’ve been split up into smaller PRs, though I think I am starting to get into this new commit style :-). Anyway, this does a couple of things:

In support of this, it required splitting the ElementFocuser into an ElementFocuser and a BorderDrawer. A lot of API naming cleanup and code tidying was done too.

A further PR will add UI to the pop-up that mouse users can use to access this feature.

* Handle Enter keydown events.
* Use tabindex=0 rather than href=# so that when the user returns to the
  page, they are not moved, and the install/update status is not lost.
* Tidy up some FIXMEs (can address later; it is generally tidier now
  than it was).
* Change the reset settings message to indicate it resets to defaults.
* Handle show all command in content script (does not toggle yet).
* Avoid spurious note creation if GUI setting does not really change.
* Reset settings to defualts rather than clearing entire storage area.
* Add a BorderManager to handle drawing of borders on element(s).
* ElementFocuser concnetrates on focusing one element.
* Add a function to enumerate all landmarks to LandmarksFinder.
* Update ID of reset button in options to make it clearer.
* Do not draw a border around an element that already has one.

Several FIXMEs to address - notably need to ensure that toggled-on
borders remain present when the user has momentary borders and moves
between elements, support toggling off, and work out if ElementFocuser
should continue to act as a pass-through, but making good progress.
* Keep it clean by only "new"ing things in the content script.
* Ensure that uses of "window" and "document" are "escaped".
* Clarify variable names in the content script.
* Move things to BorderManager that it should be doing.
* Update calls from content script.
* Tweak some use of defining public APIs.

Need to address potentially doing some stuff simpler using the "that = this" technique.
Use this.removeBorderOnCurrentlyFocusedElement() for both public and
private calls.
Use this.addBorder() for public and private API.
* Improve function names.
* Reflect latest responsibilities split.
* Add some comments to address.
...to make it clear that after a change to the document, nothing would
automatically be added, but the current state reflected as far as
possible (i.e. removing border on focused element if it has gone;
updating all borders).

Currently it does not remove borders on elements that no longer exist
when it is trying to resize the borders. This will lead to errors, but
there is already a FIXME about it.
When all landmarks are showing, the borders are not added, nor removed,
when moving between landmarks. BorderType preference changes also have
no effect. Other border prefrences do, though.
This fixes ElementFocuser to properly handle the change of borderType.

Now the problem I thought I should find in the previous commit, but
could not reproduce, is here :-).
* Clearer API names.
* More logical public/private split.
* Fix issue of borders that can disappear due to settings change.
* Remove need for "that = this".
Originally this seemed like a good idea because it keeps the state apart
from the ElementFocuser, but there were several things in the
ElementFocuser that needed to keep track (because the prefs code could
run at any time), so in the end it made sense to manage the state there.
* Clear up logic and function names for dealing with removed elements
  when refreshing in BorderDrawer.
* Fix typo that was breaking the adding of borders to newly-added
  landmarks.
@matatk matatk merged commit 10691ee into master Jan 11, 2019
@matatk matatk deleted the show-all-landmarks-toggle branch January 11, 2019 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant