126 Commits

Author SHA1 Message Date
ec40cd5b3e feat(alert): add slots to controller 2025-03-28 14:15:07 -07:00
4c598d5a34 feat(alert): add slot for customization 2025-03-25 14:20:48 -07:00
4df0e0f4c0 fix(alert): change focused element and improve keyboard navigation (#30220)
Issue number: internal

## What is the current behavior?
> Once Alert gets open the focusable element was the ion-alert itself.
> <img width="279" alt="Screenshot 2025-02-27 at 18 07 19"
src="https://github.com/user-attachments/assets/50ad3b75-ba32-4dd1-b17e-c5a5bf16f93b"
/>


## What is the new behavior?
In order to mimick native alert a11y behaviour...

Changed the focused element based on the amount of existing buttons.
> If there is only 1 button, it should be that one focused
> <img width="304" alt="Screenshot 2025-02-27 at 18 04 52"
src="https://github.com/user-attachments/assets/e273f65a-5347-4a29-a156-f6e57852f0dc"
/>

> Otherwise it should focus the `.alert-wrapper` container
> <img width="284" alt="Screenshot 2025-02-27 at 18 05 02"
src="https://github.com/user-attachments/assets/4a8507f3-a31f-40b9-8cd7-478ec881e3ed"
/>
>
> **NOTE**: The yellow outline it's just for demo purposes, it was not
implemented 🤪


## Does this introduce a breaking change?

- [ ] Yes
- [X] No


## Other information
- Also updated support to the shiftTab keyboard navigation.
- Updated tests and screenshots with the latest changes.

---------

Co-authored-by: Maria Hutt <thetaPC@users.noreply.github.com>
2025-03-06 11:16:04 +00:00
0fdcb32ce0 fix(alert): use correct heading structure for subHeader when header exists (#29964)
- The `header` will continue to always render as an `<h2>` element.
- If there is no `header` defined, the `subHeader` will continue to render as an `<h2>` element.
- If there is a `header` defined, the `subHeader` will render as an `<h3>` element.
- Updates `ariaLabelledBy` to include both `header` and `subHeader` ids when both are defined.
- Updates the `a11y` e2e test to use new values & check for tag names.
2024-11-04 16:10:58 -05:00
c3b58f1620 fix(overlays): hide the focus trap div from screen readers (#29970)
Issue number: resolves #29858

---------

## What is the current behavior?
When swiping between elements using Android TalkBack, a green box is
shown for certain overlays and it gains focus at the beginning and end
of those overlays:

<img width="419" alt="Screenshot 2024-10-25 at 2 44 45 PM"
src="https://github.com/user-attachments/assets/dffd8126-ec1d-4b6f-87fc-6488c7c09aab">

## What is the new behavior?
The `aria-hidden` attribute is now added to the focus trap divs to hide
them from screen readers, without preventing these divs from trapping
keyboard focus.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

## Other information
Dev build: `8.3.4-dev.11729882231.1b2e7f13`
2024-10-29 14:04:43 +00:00
1295cedae9 fix(alert): do not overwrite id set in htmlAttributes (#29708)
Issue number: resolves #29704

---------

<!-- 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?
Setting the id of an alert via htmlAttributes doesn't work due to it
being overwritten by the overlay id.

## What is the new behavior?
Setting the id of an alert via htmlAttributes works.

## 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

First time PR, long time fan. Please let me know if I missed any of the
contributing guidelines, happy to change anything!
2024-07-15 14:51:14 +00:00
e833ad4649 docs(overlays): clarify how to remove an overlay (#28989)
In https://github.com/ionic-team/ionic-framework/issues/28981 there was
some confusion surrounding how to remove an overlay from the DOM if it
was never presented. The `dismiss` method will remove the overlay from
the DOM, but only if the overlay is visible. Otherwise, it's a no-op.

This PR updates the `dismiss` method docs for each overlay component to
note that developers can use the browser's remove method to remove the
element from the DOM.
2024-02-08 18:36:24 +00:00
a3cd204f61 fix(overlays): trigger is configured on load (#28526)
Issue number: resolves #28524

---------

<!-- 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. -->

Watchers in Stencil are constructed sometime between `connectedCallback`
and `componentDidLoad`. If a property is set/changed during that time it
is possible for the callback associated with the watcher to not fire
because the watcher has not been setup yet. This is most often with
`dist-custom-elements` and frameworks such as Angular when using a
binding (i.e. `[trigger]` instead of `trigger`)

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

- The trigger callback associated with the watcher is manually called in
`componentDidLoad` for each overlay.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->


Dev build: `7.5.5-dev.11699974376.13a15397`

Note: This is a timing related bug due to a behavior in Stencil, so I
did not write automated tests. However, I manually verified that this
issue a) reproduces on `main` and b) is fixed with this dev build for
each overlay component.
2023-11-29 21:53:33 +00:00
72b389993d fix(alert): stop Enter keypress for checkboxes (#28279) 2023-10-04 13:51:44 -07:00
584e9d3be2 fix(overlays): prevent overlays from getting stuck open (#28069)
Issue number: resolves #27200 

---------

<!-- 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. -->
A bug occurs when you click twice quickly to open an overlay with a
small timeout. In some cases, the overlay will present, dismiss,
present, then not dismiss the second time, getting stuck open. You can
reproduce manually this by grabbing the test HTML included in this PR
and putting it in a branch that doesn't include a fix.

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

- When an overlay with a short timeout is triggered twice quickly, it
will open-close-open-close.
- The behavior is the same for all overlay components

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

Relevant links:
* https://github.com/ionic-team/ionic-framework/issues/27200
* https://ionic-cloud.atlassian.net/browse/FW-4374
* https://ionic-cloud.atlassian.net/browse/FW-4053

I'm not sure how to write an automated test for this bug due to the
short timeout required.

You can manually test the fix in [this
Stackblitz](https://stackblitz.com/edit/g1kjci?file=package.json) by
changing the Ionic version between 7.3.1 and
7.3.2-dev.11693262117.17edbf6d

---------

Co-authored-by: Liam DeBeasi <liamdebeasi@users.noreply.github.com>
2023-08-31 16:30:43 +00:00
3f093cec4f Merge remote-tracking branch 'origin/main' into sync-7.3-with-main 2023-08-04 14:01:51 -05:00
a0e6ac6013 fix(many): overlays present if isOpen is true on load (#27933)
Issue number: resolves #27928 

---------

<!-- 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. -->

Action sheet, alert, picker, and toast did not have logic where the
overlay presents if `isOpen="true"` on load. Modal, popover, and loading
had this logic but did not have test coverage.

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

- Updated action sheet, alert, picker, and toast to present if
`isOpen="true"` on load
- Added test coverage to all overlays for this functionality.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

Dev build: `7.2.3-dev.11691156718.1638345c`
2023-08-04 17:00:21 +00:00
06be0e5111 feat(alert): add htmlAttributes property for passing attributes to buttons (#27862)
Issue number: N/A

---------

## What is the current behavior?
Buttons containing only icons are not accessible as there is no way to
pass an `aria-label` attribute (or any other html attribute).

## What is the new behavior?
- Adds the `htmlAttributes` property on the `AlertButton` interface 
- Passes the `htmlAttributes` to the buttons
- Adds a test to verify `aria-label` and `aria-labelled-by` are passed
to the button

## Does this introduce a breaking change?

- [ ] Yes
- [x] No
2023-07-31 13:16:17 -04:00
8043fcf42c lint 2023-05-05 13:30:32 -05:00
6c68c56a7f Merge remote-tracking branch 'origin/main' into chore/sync-with-main-6 2023-05-05 13:30:21 -05:00
9313a914b7 fix(overlays): assign incremental id to overlay host (#27278)
Issue number: Internal

---------

<!-- Please refer to our contributing documentation for any questions on
submitting a pull request, or let us know here if you need any help:
https://ionicframework.com/docs/building/contributing -->

<!-- Some docs updates need to be made in the `ionic-docs` repo, in a
separate PR. See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#modifying-documentation
for details. -->

<!-- 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. -->

The counter for incrementing the `id` and `z-index` of an overlay is
incremented whenever the `connectedCallback` is fired for an overlay.

When an overlay is presented and/or conditionally rendered, the overlay
`id` can increment by `n+2` instead of `n+1`.

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

- Increments all overlay ids consistently
- Removes legacy `ion-modal-{id}` and `ion-popover-{id}` logic
- Adds unit tests for the id behavior
- Tests are split up into separate files so that the counter is always
starting from `0`
- Adds an integration test with the Angular test app to verify
conditional rendering behavior

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
2023-05-03 17:24:19 +00:00
0a0345a84a refactor(many): use utils import (#27160) 2023-04-12 13:25:14 -07:00
f750c8756f chore(): sync with main 2023-03-29 09:17:21 -04:00
5c0ead37bf docs(config): update innerHTML comments (#27032) 2023-03-27 15:14:02 -04:00
a396e8857b refactor(alert): switch ev.code to ev.key (#27023) 2023-03-24 13:31:30 -07:00
eb10a2e5f6 chore(): sync with main 2023-03-24 14:37:39 -04:00
3b0af7c55d feat(config): add option to disable custom html functionality (#26956) 2023-03-22 13:59:59 -04:00
1a8bd6d8c6 chore(deps): update to stencil v3 (#26663) 2023-01-31 18:07:22 -05:00
b78b454e08 revert(): revert base components feature (#26692)
The Ionic Framework team would like to re-evaluate our approach to improving customization options when building mobile applications. We are looking at other solutions that a) make customizing an app UI easier and b) are applicable to a broader set of developers.
2023-01-30 11:52:36 -05:00
18f109c7da feat(base-components): add ability to remove ios and md theme (#26669) 2023-01-24 16:18:35 -05:00
e8fb9e7328 chore(): sync with main 2023-01-23 13:38:16 -05:00
c2e1ad385d chore(many): replace any types and add tech debt tickets (#26293)
Co-authored-by: Liam DeBeasi <liamdebeasi@users.noreply.github.com>
2023-01-06 09:34:55 -06:00
08c0a5520a feat(alert): add ability to use alert inline (#26316) 2022-11-18 13:32:27 -06:00
322a1dbcd0 refactor(types): remove overlay attribute interfaces (#26181)
BREAKING CHANGE:

`ActionSheetAttributes`, `AlertAttributes`, `AlertTextareaAttributes`, `AlertInputAttributes`, `LoadingAttributes`, `ModalAttributes`, `PickerAttributes`, `PopoverAttributes`, and `ToastAttributes` have been removed. Developers should use `{ [key: string]: any }` instead.
2022-10-28 16:12:28 -04:00
73a742bf5b chore(lint): resolve new lint errors 2022-09-19 15:08:28 +00:00
c0f287e525 chore(): sync with main 2022-09-16 15:24:24 -04:00
27318d75df fix(alert): use aria-labelledby and aria-describedby instead of aria-label (#25805)
Co-authored-by: Liam DeBeasi <liamdebeasi@users.noreply.github.com>
2022-08-23 15:31:00 -05:00
ae6aa0cb8e chore(eslint): add strict-boolean-expressions rule (#25768) 2022-08-23 11:50:02 -05:00
fe849cf331 Merge remote-tracking branch 'origin/main' into sync-with-main 2022-08-23 10:46:54 -05:00
d395a73cb6 fix(alert): add default aria-label (#25800) 2022-08-22 15:11:58 -05:00
8e4783c172 feat(alert): accept Promise for button handler (#25702)
Resolves #25700

Co-authored-by: Sean Perkins <sean@ionic.io>
2022-08-03 11:33:37 -04:00
5676bab316 lint(eslint): migrate to eslint and prettier (#25046) 2022-04-04 11:12:53 -04:00
b3759aed5b fix(overlays): declarative modals now work properly with the hardware back button (#24165) 2021-11-05 10:04:13 -04:00
ecb30af4d8 chore(): resolve merge conflicts for beta 2021-09-15 12:02:43 -04:00
bd96a81ff8 feat(action-sheet, loading, modal, picker, popover): pass HTML attributes to host element (#23929) 2021-09-15 10:02:19 -04:00
73a1daf0aa feat(alert, toast): pass arbitrary HTML attributes to host element (#23891)
resolves #23825
2021-09-14 22:44:57 -04:00
9e24a0b493 feat(action-sheet, alert): add id to AlertButton and ActionSheetButton (#18992)
resolves #22959

Co-authored-by: Liam DeBeasi <liamdebeasi@icloud.com>
2021-06-29 14:17:19 -04:00
ea52db66f0 fix(select): improvements for announcing placeholder and value on screenreaders (#22556)
- Hides select text from screen readers so it isn't announced twice (Android talkback needs this)
- Adds the placeholder text to be announced if there is no value
- Don't add a comma if there is no value/placeholder (NVDA speech viewer)
- Don't announce alert label twice
2020-11-25 15:47:14 -05:00
afcc46e1cc fix(radio): properly announce radios on screen readers and resolve axe errors (#22507) 2020-11-24 11:43:59 -05:00
9659ad6334 fix(item): only add click event listener to items with inputs (#22352)
This stops screen readers, such as NVDA, from reading every item as clickable even when it is text only.

fixes #22011
2020-11-04 16:19:38 -05:00
e9b2cc8453 fix(alert): update to follow accessibility guidelines outlined by wai-aria (#22159)
This also fixes the Select "alert" interface as it uses this component

WAI-ARIA Guidelines:

- Tab and Shift + Tab: Move focus into and out of the radio group. When focus moves into a radio group :
  - If a radio button is checked, focus is set on the checked button.
  - If none of the radio buttons are checked, focus is set on the first radio button in the group.
- Space: checks the focused radio button if it is not already checked.
- Right Arrow and Down Arrow: move focus to the next radio button in the group, uncheck the previously focused button, and check the newly focused button. If focus is on the last button, focus moves to the first button.
- Left Arrow and Up Arrow: move focus to the previous radio button in the group, uncheck the previously focused button, and check the newly focused button. If focus is on the first button, focus moves to the last button.

closes #21744
2020-09-24 17:09:54 -04:00
ae47d77710 chore(api): internal updates required for stencil 2 upgrade (#21889)
Stencil 2 is removing deprecated APIs, and these are the remaining ones Ionic has been using.
2020-08-06 10:33:22 -05:00
fff4aec6cf fix(overlays): trap focus inside overlay components except toast (#21716)
fixes #21647
2020-07-22 12:09:31 -04:00
79518468dd fix(overlays): move prepareOverlay to connectedCallback
For custom elements builds, overlays cannot use hasAttribute() in the constructor, so moving it to connectedCallback instead.
2020-07-21 13:07:54 -05:00
5bf83b80d7 feat(all): add optional generics typings for overlay component methods (#21393) 2020-06-03 09:08:27 -04:00