Skip to content

Commit

Permalink
fix: remove the input entirely and replace it with a touch target
Browse files Browse the repository at this point in the history
  • Loading branch information
pennin committed Aug 28, 2024
1 parent 192f17e commit cf84a27
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
8 changes: 2 additions & 6 deletions radio/internal/_radio.scss
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,13 @@ $_md-sys-motion: tokens.md-sys-motion-values();
);
}

// <input> is also the touch target
input {
appearance: none;
.touch-target {
height: 48px;
margin: 0;
position: absolute;
width: 48px;
cursor: inherit;
}

:host([touch-target='none']) input {
:host([touch-target='none']) .touch-target {
width: 100%;
height: 100%;
}
Expand Down
10 changes: 2 additions & 8 deletions radio/internal/radio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class Radio extends radioBaseClass {
protected override render() {
const classes = {'checked': this.checked};
return html`
<div class="container ${classMap(classes)}" inert">
<div class="container ${classMap(classes)}" aria-hidden="true">
<md-ripple
part="ripple"
.control=${this}
Expand All @@ -119,13 +119,7 @@ export class Radio extends radioBaseClass {
<circle class="inner circle" cx="10" cy="10" r="5" />
</svg>
<input
id="input"
type="radio"
tabindex="-1"
.checked=${this.checked}
.value=${this.value}
?disabled=${this.disabled} />
<div class="touch-target"></div>
</div>
`;
}
Expand Down

0 comments on commit cf84a27

Please sign in to comment.