-
Notifications
You must be signed in to change notification settings - Fork 7
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
Narrow regions; Split borders; Pointer events; Full-height/width regions #179
Conversation
* This uncouples the label from the border, so it can be repositioned if needed. * We have an extra element to track now, but it gives much greater flexibility. * Remove some magic numbers (outline and border widths). Note: this needs testing on pages that scroll sideways.
* Ensure that the label occupies only one line. * Ensure that the label prefers being on the left. * Ensure that the point at which the label flips between left and right is consistent.
src/static/content.focusing.js
Outdated
|
||
// Is part of the label off-screen? | ||
const labelBounds = label.getBoundingClientRect() | ||
if (labelBounds.left < 0 || label.scrollWidth > label.offsetWidth) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the scrollWidth stuff needed now that the "left" property is removed first?
src/static/content.focusing.js
Outdated
// Try aligning the right edge of the label to the right edge of the | ||
// border. | ||
// | ||
// If the label is too wide, align the left edge of the label to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"too wide" actually means "goes off-screen left"
src/static/content.focusing.js
Outdated
|
||
const settings = {} // caches options locally (for simpler code) | ||
let labelFontColour = null // computed based on border colour | ||
const contrastChecker = new ContrastChecker() | ||
|
||
let currentBorderResizeHandler = null | ||
let currentlyFocusedElementInfo = null // keep for border redraws | ||
let currentlyFocusedElementBorder = null // indicates border; resizing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename these to indicate they're elements themselves?
* Remvoe the now-unnecessary scrollWidth checks. * Rename variables for clarity. * Re-order declarations and tidy up the formatting.
* Tidy up side-scrolling test page (make it fit vertically nicely). * Add a test page for viewport-filling regions in both dimensions.
* Ensure that the border and label are drawn within landmarks@ bounding boxes. * Resultant minor code tidy-ups. * Switch the border and label to border-box sizing. * Fixes #167.
Use document.documentElement.clientWidth as this takes the width of the scrollbars (if rendered) into account, whereas window.innerWidth did not.
This moves labels if need be to ensure they’re always visible. It also decouples the label from the border, to enable that re-positioning and to stop the “split borders” effect.
This also allows pointer events (such as mouse hover) to pass through the landmark border
<div>
so that the user can interact with the web page as normal.Borders are drawn inside the space required by elements, to avoid introducing scrollbars when full-width/height regions are present.
Fixes #166
Fixes #175
Fixes #167