Skip to content

Commit

Permalink
fix(tab): add closure conformance types
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 545742981
  • Loading branch information
AndrewJakubowicz authored and copybara-github committed Jul 5, 2023
1 parent b2d2321 commit d80b7b5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion tabs/lib/tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {html, isServer, LitElement, nothing, PropertyValues} from 'lit';
import {property, query} from 'lit/decorators.js';
import {classMap} from 'lit/directives/class-map.js';

import {ARIAMixinStrict} from '../../internal/aria/aria.js';
import {requestUpdateOnAriaChange} from '../../internal/aria/delegate.js';
import {dispatchActivationClick, isActivationClick} from '../../internal/controller/events.js';

Expand Down Expand Up @@ -99,14 +100,16 @@ export class Tab extends LitElement {
const contentClasses = {
'inline-icon': this.inlineIcon,
};
// Needed for closure conformance
const {ariaLabel} = this as ARIAMixinStrict;
return html`
<button
class="button"
role="tab"
.tabIndex=${this.focusable && !this.disabled ? 0 : -1}
aria-selected=${this.selected ? 'true' : 'false'}
?disabled=${this.disabled}
aria-label=${this.ariaLabel || nothing}
aria-label=${ariaLabel || nothing}
>
<md-focus-ring inward></md-focus-ring>
<md-elevation></md-elevation>
Expand Down
4 changes: 3 additions & 1 deletion tabs/lib/tabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@ export class Tabs extends LitElement {
Object.defineProperties(event, {
'defaultPrevented': {value: false, writable: true, configurable: true},
'preventDefault': {
value() {
// Type needed for closure conformance. Using the Event type results
// in a type error.
value(this: {defaultPrevented: boolean}) {
this.defaultPrevented = true;
},
writable: true,
Expand Down

0 comments on commit d80b7b5

Please sign in to comment.