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

[v4 beta-3] Unexpected display none in d-print-* classes applied to non print media #25221

Closed
jarvelov opened this issue Jan 6, 2018 · 1 comment

Comments

@jarvelov
Copy link

jarvelov commented Jan 6, 2018

Description

The .d-print-* classes unexpectedly added a display: none !important when adding class to an element. As seen in the source of display.scss

In the documentation there is no mention of the print classes having this behaviour, rather to the contrary in the example provided in the docs is the following markup:

<div class="d-none d-lg-block d-print-block">Hide up to large on screen, but always show on print</div>

And as seen in the docs, the above div is not visible on large screens, despite what the d-lg-block class would make one assume.

Proposed resolutions

  1. Remove the display: none !important style from the d-print-* classes.

  2. Include a mention in the documentation that applying a d-print-* class will also hide the element on all except @print media. Also remove the div from above from the docs as it is confusing and infers that the element should be visible on large screens.

I would strongly argue in favor of the first proposed resolution. Since the d-none classes exists it would make sense to add that class to any element which should only be included when printing.

Demo

Fiddle: https://jsfiddle.net/b2zfLvpe/
As seen in the documentation: https://getbootstrap.com/docs/4.0/utilities/display/#display-in-print

@jarvelov jarvelov changed the title Unexpected display none in d-print-* classes applied to non print media [v4 beta-3] Unexpected display none in d-print-* classes applied to non print media Jan 6, 2018
@mdo
Copy link
Member

mdo commented Jan 7, 2018

Yeah, this needs to change. Super inconsistent with our display utilities and breaks the screen ones.

@bardiharborow bardiharborow added v4 and removed v4 labels Jan 7, 2018
@mdo mdo added the has-pr label Jan 11, 2018
mdo added a commit that referenced this issue Jan 11, 2018
Fixes #25221.

I agree with the referenced issue—this is unexpected and also causes a serious bug when mixed with other utility classes. I don't know why this wasn't an issue in v3—perhaps folks weren't using these as widely? I'm planning on leaving this for a v4.x or v4.0.x release to get some feedback.
mdo added a commit that referenced this issue Jan 18, 2018
* Prevent print utils from overriding all other display utils

Fixes #25221.

I agree with the referenced issue—this is unexpected and also causes a serious bug when mixed with other utility classes. This wasn't an issue in v3 given we had different utilities for hiding that weren't focused on display property.

* Add printing changes to migration docs

* unrelated heading sentence case change

* List out all .d-print- classes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants