Skip to content

Commit

Permalink
fix: checkbox accessibility (#195)
Browse files Browse the repository at this point in the history
* fix: checkbox accessibility

* fix: tappable area and variables

* tests: update checkobox tests
  • Loading branch information
phoebus-84 authored Dec 23, 2024
1 parent 72ea3f2 commit 0a14396
Show file tree
Hide file tree
Showing 8 changed files with 727 additions and 42 deletions.
4 changes: 2 additions & 2 deletions src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export namespace Components {
"size": Size;
}
interface DHorizontalStack {
"gap": 2 | 4 | 8;
"gap": Gap;
}
interface DIcon {
"icon": string;
Expand Down Expand Up @@ -710,7 +710,7 @@ declare namespace LocalJSX {
"size"?: Size;
}
interface DHorizontalStack {
"gap"?: 2 | 4 | 8;
"gap"?: Gap;
}
interface DIcon {
"icon"?: string;
Expand Down
1 change: 1 addition & 0 deletions src/components/activity-card/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
| ------------- | ------------- | ----------- | --------- | ----------- |
| `date` | `date` | | `string` | `undefined` |
| `description` | `description` | | `string` | `undefined` |
| `href` | `href` | | `string` | `undefined` |
| `logo` | `logo` | | `string` | `undefined` |
| `message` | `message` | | `string` | `undefined` |
| `read` | `read` | | `boolean` | `false` |
Expand Down
17 changes: 17 additions & 0 deletions src/components/checkbox/d-checkbox.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
:host {
display: block;
}
ion-checkbox {
--checkbox-background: var(--highlight);
--checkbox-background-checked: var(--accent);
width: 48px;
height: 48px;
justify-items: center;
margin-left: -12px;

}
ion-checkbox::part(container) {
border-radius: 1px;
border: 2px solid;
border-color: var(--on-alt);
--checkmark-color: var(--stroke);
--checkmark-width:3px;
--size: 22px;
}
2 changes: 1 addition & 1 deletion src/components/checkbox/d-checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class DCheckbox {
return (
<Host>
<d-vertical-stack>
<d-horizontal-stack>
<d-horizontal-stack class="items-center" gap={0}>
<ion-checkbox onIonChange={e => this.updateValue(e.detail.checked)} checked={this.checked}></ion-checkbox>
<div>
<slot />
Expand Down
2 changes: 1 addition & 1 deletion src/components/checkbox/test/d-checkbox.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('d-checkbox', () => {
<d-checkbox>
<mock:shadow-root>
<d-vertical-stack>
<d-horizontal-stack>
<d-horizontal-stack class="items-center" gap="0">
<ion-checkbox></ion-checkbox>
<div>
<slot></slot>
Expand Down
3 changes: 2 additions & 1 deletion src/components/horizontal-stack/d-horizontal-stack.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Component, Host, Prop, h } from '@stencil/core';
import { Gap } from '../types';

@Component({
tag: 'd-horizontal-stack',
styleUrl: 'd-horizontal-stack.css',
shadow: true,
})
export class DHorizontalStack {
@Prop() gap: 2 | 4 | 8 = 2;
@Prop() gap: Gap = 2;

render() {
return (
Expand Down
6 changes: 3 additions & 3 deletions src/components/horizontal-stack/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

## Properties

| Property | Attribute | Description | Type | Default |
| -------- | --------- | ----------- | ------------- | ------- |
| `gap` | `gap` | | `2 \| 4 \| 8` | `2` |
| Property | Attribute | Description | Type | Default |
| -------- | --------- | ----------- | ------------------ | ------- |
| `gap` | `gap` | | `0 \| 2 \| 4 \| 8` | `2` |


## Dependencies
Expand Down
Loading

0 comments on commit 0a14396

Please sign in to comment.