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

Narrow regions; Split borders; Pointer events; Full-height/width regions #179

Merged
merged 13 commits into from
Jun 9, 2018

Conversation

matatk
Copy link
Owner

@matatk matatk commented Jun 3, 2018

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

matatk added 5 commits June 3, 2018 14:40
* 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.

// Is part of the label off-screen?
const labelBounds = label.getBoundingClientRect()
if (labelBounds.left < 0 || label.scrollWidth > label.offsetWidth) {
Copy link
Owner Author

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?

// 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
Copy link
Owner Author

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"


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
Copy link
Owner Author

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?

matatk and others added 4 commits June 7, 2018 08:51
* 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.
@matatk matatk changed the title Narrow regions and split borders Narrow regions; Split borders; Pointer events; Full-height/width regions Jun 7, 2018
matatk and others added 4 commits June 8, 2018 18:51
* 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.
@matatk matatk merged commit 91b456d into master Jun 9, 2018
@matatk matatk deleted the narrow-regions-and-split-borders branch June 9, 2018 13:01
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.

1 participant