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

Tabs have a shadow if its parent has --md-elevation-level #5137

Closed
datvm opened this issue Oct 28, 2023 · 2 comments · Fixed by #5295 · 4 remaining pull requests
Closed

Tabs have a shadow if its parent has --md-elevation-level #5137

datvm opened this issue Oct 28, 2023 · 2 comments · Fixed by #5295 · 4 remaining pull requests
Assignees

Comments

@datvm
Copy link
Contributor

datvm commented Oct 28, 2023

What is affected?

Component

Description

I was so confused why my tabs have dark borders except the 3 tabs surrounding the selecting tab:

image

Turned out it's due to a parent's --md-elevation-level (for md-elevation effect).

Reproduction

Lit Playground with both the problematic one and a workaround one:

image

  <div style="position: relative; --md-elevation-level: 3; padding: 1rem;">
    <md-elevation></md-elevation>
    
    <p>Other content</p>
    
    <md-tabs><md-secondary-tab>😄 Smileys &amp; People</md-secondary-tab><md-secondary-tab>🐕 Animals &amp; Nature</md-secondary-tab><md-secondary-tab>🍊 Food &amp; Drink</md-secondary-tab><md-secondary-tab>💃 Activity</md-secondary-tab><md-secondary-tab>✈️ Travel &amp; Places</md-secondary-tab><md-secondary-tab>🎁 Objects</md-secondary-tab><md-secondary-tab>🕛 Symbols</md-secondary-tab><md-secondary-tab>⚽ Sports</md-secondary-tab><md-secondary-tab>🚩 Flags</md-secondary-tab></md-tabs>

    <p>Workaround:</p>
    <md-tabs style="--md-elevation-level: 0"><md-secondary-tab>😄 Smileys &amp; People</md-secondary-tab><md-secondary-tab>🐕 Animals &amp; Nature</md-secondary-tab><md-secondary-tab>🍊 Food &amp; Drink</md-secondary-tab><md-secondary-tab>💃 Activity</md-secondary-tab><md-secondary-tab>✈️ Travel &amp; Places</md-secondary-tab><md-secondary-tab>🎁 Objects</md-secondary-tab><md-secondary-tab>🕛 Symbols</md-secondary-tab><md-secondary-tab>⚽ Sports</md-secondary-tab><md-secondary-tab>🚩 Flags</md-secondary-tab></md-tabs>
  </div>

Workaround

See above, setting <md-tabs style="--md-elevation-level: 0"> fix it. I think the component itself should reset this.

Is this a regression?

No or unsure. This never worked, or I haven't tried before.

Affected versions

1.0.1

Browser/OS/Node environment

Microsoft Edge Version 118.0.2088.69 (Official build) (64-bit)

@asyncLiz asyncLiz assigned asyncLiz and unassigned asyncLiz Oct 30, 2023
@asyncLiz
Copy link
Collaborator

I agree that the tab should include :host { --md-elevation-level: 0; }

On a bigger note, these individual tab elevations do not make sense. We may want to consider deprecating tab elevation in favor of using <md-elevation> wrapped around the <md-tabs> to give the proper shadow.

As it's implemented, it's not possible to set a single shadow for the row of tabs, they incorrectly have their own shadows.

@asyncLiz
Copy link
Collaborator

Reference b/316459034 to clean this up

@asyncLiz asyncLiz self-assigned this Dec 15, 2023
copybara-service bot pushed a commit that referenced this issue Dec 15, 2023
copybara-service bot pushed a commit that referenced this issue Dec 15, 2023
copybara-service bot pushed a commit that referenced this issue Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment