Skip to content

merge main #30387

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

Merged
merged 23 commits into from
May 1, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d197489
v8.5.4
Ionitron Apr 9, 2025
fd4ffdd
chore(): update package lock files
Ionitron Apr 9, 2025
51de007
chore(): update package lock files
brandyscarney Apr 9, 2025
1bc4f59
merge release-8.5.4 (#30347)
brandyscarney Apr 9, 2025
b1bc58f
fix(toggle): ensure proper visual selection when navigating via Voice…
ShaneK Apr 11, 2025
396ff3d
chore(deps): update dependency @capacitor/core to v7.2.0 (#30336)
renovate[bot] Apr 11, 2025
e1a4512
chore(deps): update dependency node to v22 (#30326)
renovate[bot] Apr 11, 2025
44efdb0
chore(deps): update dependency @clack/prompts to v0.10.1 (#30351)
renovate[bot] Apr 11, 2025
8dd566b
fix(modal): add expandToScroll property to ModalOptions (#30357)
luisbytes Apr 14, 2025
d52fca0
fix(config): allow LogLevel to work with isolatedModules and update a…
brandyscarney Apr 16, 2025
cad1c61
fix(select): update icon color and use correct focused class (#30342)
thetaPC Apr 16, 2025
c5c4d1d
v8.5.5
Ionitron Apr 16, 2025
4fc1366
chore(): update package lock files
Ionitron Apr 16, 2025
5a564d6
merge release-8.5.5 (#30365)
brandyscarney Apr 16, 2025
b0d88ea
chore(deps): update capacitor to v7.0.1 (#30358)
renovate[bot] Apr 16, 2025
3f0e43d
docs(core): update Docker to Rancher desktop (#30372)
brandyscarney Apr 25, 2025
8ef79cf
chore(deps): update playwright (#30367)
renovate[bot] Apr 29, 2025
7a9d138
fix(item): emit click event once when clicking padded space on item a…
brandyscarney Apr 30, 2025
fbbb5e3
v8.5.6
Ionitron Apr 30, 2025
e6e6483
chore(): update package lock files
Ionitron Apr 30, 2025
bf396c9
merge release-8.5.6 (#30381)
brandyscarney Apr 30, 2025
6307441
Merge branch 'main' into chore/merge-main
brandyscarney May 1, 2025
d8582e4
chore(): add updated snapshots
Ionitron May 1, 2025
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
Prev Previous commit
Next Next commit
fix(toggle): ensure proper visual selection when navigating via Voice…
…Over in Safari (#30349)

Issue number: resolves internal

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->
Currently, MacOS voice over on Safari does not recognize ion-toggle
correctly and fails to highlight the element properly

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

By adding the role property to the host element, we're correctly
identifying the toggle so Safari knows how to handle it.

## Does this introduce a breaking change?

- [ ] Yes
- [X] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer
for more information.
-->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
  • Loading branch information
ShaneK authored Apr 11, 2025
commit b1bc58f1c8ffdc859e3f4349040bb1ad6e383d1e
8 changes: 5 additions & 3 deletions core/src/components/toggle/toggle.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@

max-width: 100%;

outline: none;

cursor: pointer;
user-select: none;
z-index: $z-index-item-input;
Expand Down Expand Up @@ -69,8 +67,12 @@
pointer-events: none;
}

/**
* The native input must be hidden with display instead of visibility or
* aria-hidden to avoid accessibility issues with nested interactive elements.
*/
input {
@include visually-hidden();
display: none;
}

// Toggle Wrapper
Expand Down
45 changes: 39 additions & 6 deletions core/src/components/toggle/toggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import type { ToggleChangeEventDetail } from './toggle-interface';
})
export class Toggle implements ComponentInterface {
private inputId = `ion-tg-${toggleIds++}`;
private inputLabelId = `${this.inputId}-lbl`;
private helperTextId = `${this.inputId}-helper-text`;
private errorTextId = `${this.inputId}-error-text`;
private gesture?: Gesture;
Expand Down Expand Up @@ -246,6 +247,15 @@ export class Toggle implements ComponentInterface {
}
}

private onKeyDown = (ev: KeyboardEvent) => {
if (ev.key === ' ') {
ev.preventDefault();
if (!this.disabled) {
this.toggleChecked();
}
}
};

private onClick = (ev: MouseEvent) => {
if (this.disabled) {
return;
Expand Down Expand Up @@ -355,8 +365,23 @@ export class Toggle implements ComponentInterface {
}

render() {
const { activated, color, checked, disabled, el, justify, labelPlacement, inputId, name, alignment, required } =
this;
const {
activated,
alignment,
checked,
color,
disabled,
el,
errorTextId,
hasLabel,
inheritedAttributes,
inputId,
inputLabelId,
justify,
labelPlacement,
name,
required,
} = this;

const mode = getIonMode(this);
const value = this.getValue();
Expand All @@ -365,9 +390,16 @@ export class Toggle implements ComponentInterface {

return (
<Host
role="switch"
aria-checked={`${checked}`}
aria-describedby={this.getHintTextID()}
aria-invalid={this.getHintTextID() === this.errorTextId}
aria-invalid={this.getHintTextID() === errorTextId}
onClick={this.onClick}
aria-labelledby={hasLabel ? inputLabelId : null}
aria-label={inheritedAttributes['aria-label'] || null}
aria-disabled={disabled ? 'true' : null}
tabindex={disabled ? undefined : 0}
onKeyDown={this.onKeyDown}
class={createColorClasses(color, {
[mode]: true,
'in-item': hostContext('ion-item', el),
Expand All @@ -380,7 +412,7 @@ export class Toggle implements ComponentInterface {
[`toggle-${rtl}`]: true,
})}
>
<label class="toggle-wrapper">
<label class="toggle-wrapper" htmlFor={inputId}>
{/*
The native control must be rendered
before the visible label text due to https://bugs.webkit.org/show_bug.cgi?id=251951
Expand All @@ -396,14 +428,15 @@ export class Toggle implements ComponentInterface {
onBlur={() => this.onBlur()}
ref={(focusEl) => (this.focusEl = focusEl)}
required={required}
{...this.inheritedAttributes}
{...inheritedAttributes}
/>
<div
class={{
'label-text-wrapper': true,
'label-text-wrapper-hidden': !this.hasLabel,
'label-text-wrapper-hidden': !hasLabel,
}}
part="label"
id={inputLabelId}
>
<slot></slot>
{this.renderHintText()}
Expand Down
Loading