Skip to content
This repository was archived by the owner on Mar 13, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 6 additions & 15 deletions paper-tab.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
overflow: hidden;
}

#tabContainer {
#tabContainer,
.tab-content,
#ink {
position: absolute;
top: 0;
right: 0;
Expand All @@ -24,26 +26,15 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
.tab-content {
transition: opacity .1s cubic-bezier(0.4, 0.0, 1, 1), color .1s cubic-bezier(0.4, 0.0, 1, 1);
cursor: default;
pointer-events: none;
z-index: 2;
}

:host(:not(.core-selected)) .tab-content {
opacity: 0.6;
}

#ink {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
color: #ffff8d;
}

:host[noink] #ink {
pointer-events: none;
}

:host-context(paper-tabs[noink]) #ink {
z-index: 1;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it feasible to re-order the elements in the DOM rather than resort to z-index? By moving the <paper-ripple> above <tab-content> in the DOM, document order will stack them correctly.

pointer-events: none;
color: #ffff8d;
}
24 changes: 21 additions & 3 deletions paper-tab.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@

<link rel="stylesheet" href="paper-tab.css">

<div id="tabContainer" center-justified center horizontal layout>
<div id="tabContainer">

<div class="tab-content"><content></content></div>
<div class="tab-content" center-justified center horizontal layout><content></content></div>
<paper-ripple id="ink" initialOpacity="0.95" opacityDecayVelocity="0.98"></paper-ripple>

</div>
Expand All @@ -58,7 +58,25 @@
* @type boolean
* @default false
*/
noink: false
noink: false,

eventDelegates: {
down: 'downAction'
},

/**
* Intercept the down action on the button and explicitly pass to the ripple
* @param {Event} e The down event containing, at least, an x & y property
*/
downAction: function(e) {
if (!this.noink && !this.parentElement.noink) {
var ripple = this.shadowRoot.querySelector('paper-ripple');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shadow descendants with ID attributes are accessible on this.$: this.$.ink.

if (ripple) {
ripple.downAction(e);
ripple.upAction();
}
}
}

});

Expand Down