-
Notifications
You must be signed in to change notification settings - Fork 75
Fix: print styles for web visitors #654
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
base: main
Are you sure you want to change the base?
Conversation
|
||
window.addEventListener('afterprint', () => { | ||
if (!document.body.classList.contains('oldtoc')) { | ||
document.getElementById('spec-container').before(document.getElementById('menu')); |
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.
This doesn't look like the inverse of beforeprint
, which it seems like it should be. What's this trying to accomplish?
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.
It's moving the menu element around. first it moves the menu to before the metadata block, then afterward it puts the menu back where it was, before the spec container.
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.
I don't think these event handlers operate as inverses of each other as you claim.
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.
Oh, I see. I tested it in Chrome Canary and Firefox and it appeared to do what I expected it to do. mdn seems to think they exist for the purpose I'm utilising them for.
page-break-after: always; | ||
} | ||
|
||
/* Styles for web users who wish to print (or "print") the document */ |
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.
/* Styles for web users who wish to print (or "print") the document */ | |
/* Styles for web users who wish to print (or print-to-pdf) the document */ |
I think this is what was meant by the scare quotes?
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.
lol they weren't meant to be scare quotes, it was meant to communicate that using the "print" function may not be used for the purpose of putting ink (or toner) to paper
Can you go into a little more detail about what this PR actually accomplishes? |
I got a little nerd sniped on Mastodon by a conversation about accessibility and print styles. Browsers mostly don't implement the CSS paged media module, and the web version of typical ecmarkup output doesn't use the oldtoc class, so I needed to add just a few little things to make the site printable for web visitors.
Important
I fully admit I appended some print-related event listeners to a javascript file (sdoMap.js) that I didn't otherwise spend the time to totally understand. I'm trusting the baseline knowledge of reviewers for this repo to tell me if that can/should go somewhere else.