-
Notifications
You must be signed in to change notification settings - Fork 772
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
Add print breakpoint #869
Comments
@CaerusKaru Thanks for triaging this! I'm open to submitting a pr since I really need decent print layout support. I've been fighting with getting print layouts to work/transition all day and found a few causes/problems. Problem 1Even when not using a
I'm not sure how to fix this. Maybe you or @ThomasBurleson could share some insight? I remember discussing the inline style design way back when with him. I'm not sure if this was accounted for or if there is a workaround. I feel bad posting this but here is a bad workaround/hack.
Problem 2Besides that there is another lesser issue which I think can be addressed more easily and is basically my lack of knowledge about how this lib works so far. Since the standard breakpoints no longer specify extraI've also noticed this weird behavior in chrome which is interesting. If your browser window is small when you click print your layouts do not have to "switch" and therefor you avoid bug problem 1. It ends up cutting lots of sites off to a single page or if your original layout was multiple pages you end up with missing content/pages on the end. |
Found a longstanding chrome issue about this https://bugs.chromium.org/p/chromium/issues/detail?id=571070 |
I've made some progress on a reasonable fix. The gist of it is that you add an The reason you need to hook I've tested in chrome and it is possible to get this workaround working and reliable but I need to do some more work with problem 2 from above otherwise it requires explicit |
So we've been using the fix above with good luck but found another issue from the lack of synchronous matchMedia apis. If you switch printers in the dialog(potentially other options can trigger as well) it will basically update the layout but other matchMedia's are likely to have fired and changed your layout breaking things again. I think a workaround could be discarding all matchMedia's until |
Here are the long awaited replies to this issue. Problem 1: This can be easily solved by adding a matchMedia listener on the Problem 2: As of beta 22 you can now specify priority for breakpoints, meaning you can specify that the print breakpoints always override the defaults. That being said, as discussed here, we're going to implement this as a config, where turning on the config adds a print listener, and overrules the media activations during print (ie until print breakpoint deactivation). The config would allow a developer to specify a breakpoint to activate (which could include a custom breakpoint). Without objection, I'm going to fold this into #603 to track the work moving forward. |
@CaerusKaru sounds good! FYI the print listener override solution above has been working pretty well in production for us. Ideally the fix would incorporate ignoring media changes between the I'll be sure to test any fixes on my particularly taxing page and follow #603 |
@CaerusKaru Just wanted to let you know that my I've also updated my repo linked above with the same fix but on beta 22 and can confirm the |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Feature Request
What is the desired behavior?
Add a standard breakpoint for the print media query.
What is the use-case or motivation for the desired behavior?
Many apps need to show things only when printing or saving to pdf.
Is there anything else we should know?
I know you can setup a custom breakpoint for this but I hope it is common enough to be included standard. For business apps people tend to print pages a lot and often need some extra info or some things hidden.
The text was updated successfully, but these errors were encountered: