Skip to content
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

bug: large title transition does not account for empty back button text #28751

Closed
3 tasks done
roman-rr opened this issue Dec 21, 2023 · 4 comments · Fixed by #29327
Closed
3 tasks done

bug: large title transition does not account for empty back button text #28751

roman-rr opened this issue Dec 21, 2023 · 4 comments · Fixed by #29327
Labels
package: core @ionic/core package type: bug a confirmed bug report

Comments

@roman-rr
Copy link

Prerequisites

Ionic Framework Version

v7.x, Nightly

Current Behavior

Only with @Ionic/angular > 7.5.0, when ion-back-button has empty text value:

Screenshot 2023-12-21 at 15 28 40

Note that text=" " doesn't give a error.

Expected Behavior

Allow text="" for ion-back-button component

Steps to Reproduce

  1. git clone https://github.com/roman-rr/bug-backbutton.git
  2. cd bug-backbutton
  3. npm i
  4. ionic serve
  5. Click button

Code Reproduction URL

https://github.com/roman-rr/bug-backbutton/

Ionic Info

Ionic:

Ionic CLI : 7.1.5 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 7.6.2
@angular-devkit/build-angular : 17.0.7
@angular-devkit/schematics : 17.0.7
@angular/cli : 17.0.7
@ionic/angular-toolkit : 9.0.0

Capacitor:

Capacitor CLI : 5.6.0
@capacitor/android : not installed
@capacitor/core : 5.6.0
@capacitor/ios : not installed

Utility:

cordova-res (update available: 0.15.4) : 0.14.0
native-run : 2.0.0

System:

NodeJS : v20.10.0 (/usr/local/bin/node)
npm : 10.2.3
OS : macOS Unknown

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Dec 21, 2023
@liamdebeasi liamdebeasi self-assigned this Dec 21, 2023
@liamdebeasi liamdebeasi changed the title bug: back-button with empty text crash app bug: large title transition does not account for empty back button text Dec 21, 2023
@liamdebeasi liamdebeasi added package: core @ionic/core package type: bug a confirmed bug report labels Dec 21, 2023
@ionitron-bot ionitron-bot bot removed the triage label Dec 21, 2023
@alexdabast
Copy link

Faced the same issue. A white space as "text" solve temporary the issue

<ion-back-button text=" " [defaultHref]="defaultHref"></ion-back-button>

@Mdemol
Copy link

Mdemol commented Jan 24, 2024

For me this only occurs in iOS mode. Using the temporary solution of @alexdabast for now.

Visually the app will navigate to the desired page, but without any animations. On MD-mode the animations still occur.

@liamdebeasi liamdebeasi removed their assignment Mar 28, 2024
@liamdebeasi
Copy link
Contributor

liamdebeasi commented Apr 11, 2024

Hi everyone,

Here is a dev build with a proposed fix if anyone is interested in testing: 7.8.5-dev.11713282122.18cabf98

github-merge-queue bot pushed a commit that referenced this issue Apr 30, 2024
#29327)

Issue number: resolves #28751

---------

<!-- 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 large title transition does not account for back buttons with no
text value. We assume that the [`.button-text` element
](https://github.com/ionic-team/ionic-framework/blob/bfaf528e61fd82c9106e3c5060921fb79d97156a/core/src/components/back-button/back-button.tsx#L168)
is always defined, but that is not the case when `text=""` on the back
button. As a result, devs were getting errors because we tried to get
the bounding box of a undefined.

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

- Revised the large title logic to only grab values from the back button
text if the back button text element is actually defined

There should be **no behavior change** when the back button text element
is defined.

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

Dev Build: `7.8.5-dev.11713282122.18cabf98`

⚠️ Reviewers: Please test this in the sample application on the linked
issue. Please be sure to test the following conditions:

1. When the back button text is defined
2. When the back button text is not defined
3. With the default font scale
4. With a larger font scale
@liamdebeasi
Copy link
Contributor

Thanks for the issue. This has been resolved via #29327, and a fix will be available in an upcoming release of Ionic Framework.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: core @ionic/core package type: bug a confirmed bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants