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

Can't override --paper-font-common-base_-_font-family from document level #148

Open
1 of 8 tasks
RhysyG opened this issue Aug 16, 2017 · 3 comments
Open
1 of 8 tasks

Comments

@RhysyG
Copy link

RhysyG commented Aug 16, 2017

Description

Can't overwrite default font (Roboto) using custom property mixin when any paper font mixins are referenced ie: @apply(--paper-font-sunhead); as it looks like nested CSS variables get confused.

Live example:
https://codepen.io/rhysyg03/pen/YxgYQp?editors=1100

When a CSS variable is nested, in this example:

  • font-family: var(--paper-font-subhead_-_font-family)
  • refers back to
  • font-family: var(--paper-font-common-base_-_font-family)

--paper-font-subhead_-_font-family variable refers back to variable in the same declaration (html) even if it’s been overwritten (.my-class).

Expected outcome

The NEW --paper-font-common-base_-_font-family mixin would overwrite default variable.

Actual outcome

The NEW --paper-font-common-base_-_font-family mixin DOES NOT get overwritten.

Steps to reproduce

  1. add @apply(--paper-font-body1) to a Polymer element
  2. override the @apply --paper-font-common-base mixin with custom font from the document level

Browsers Affected

  • Chrome
  • Firefox
  • Safari 9
  • Safari 8
  • Safari 7
  • Edge
  • IE 11
  • IE 10
@KeithHenry
Copy link

I have the same problem, which I've raised on SO.

I don't want to use Roboto and I don't want to download it from the Google fonts API (not all my users can access it, so they get errors or long waits).

The issue is easy to reproduce: set your own --paper-font-common-base in the app shell, before importing any components:

--paper-font-common-base: {
    font-family: 'Comic Sans'; 
    /* Not really, nobody's that evil, but problem is there for any font */
};

Import paper-radio-button - --paper-font-common-base remains unchanged. This is because that control explicitly avoids loading typography.html.

Import paper-dialog - that imports typography.html which overrides the font set:

<link rel="import" href="../font-roboto/roboto.html">

<custom-style>
<style is="custom-style">
html {
/* Shared Styles */
--paper-font-common-base: {
font-family: 'Roboto', 'Noto', sans-serif;
-webkit-font-smoothing: antialiased;
};

typography.html should not be setting --paper-font-common-base if it has already been set.

@Clay-Ferguson
Copy link

Looks like it's also impossible to override paper-item(s) in paper-menu, with the paper-font-common-base for some reason. Everything but paper-item (menu) gets set to correct font but the menu all insists on sticking to Roboto font no matter what i do.

@KeithHenry
Copy link

@Clay-Ferguson <paper-menu> has been deprecated, use <paper-listbox> instead.

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

No branches or pull requests

3 participants