Repository: ionic-team/ionic-framework
File: core/src/components/searchbar/searchbar.tsx (TypeScript)

Code before:
  /**
   * Determines whether or not the cancel button should be visible onscreen.
   * Cancel button should be shown if one of two conditions applies:
   * 1. `showCancelButton` is set to `always`.
   * 2. `showCancelButton` is set to `focus`, and the searchbar has been focused.
   */
  private shouldShowCancelButton(): boolean {
    if (this.showCancelButton === 'never' || (this.showCancelButton === 'focus' && !this.focused)) {
      return false;
    }

    return true;
  }

  /**
   * Determines whether or not the clear button should be visible onscreen.
   * Clear button should be shown if one of two conditions applies:
   * 1. `showClearButton` is set to `always`.
   * 2. `showClearButton` is set to `focus`, and the searchbar has been focused.
   */
  private shouldShowClearButton(): boolean {
    if (this.showClearButton === 'never' || (this.showClearButton === 'focus' && !this.focused)) {
      return false;
    }

    if (getIonTheme(this) === 'ionic' && this.disabled) {
      return false;
    }

    return true;
  }

  private getShape() {
    const theme = getIonTheme(this);
    const { shape } = this;

    // TODO(ROU-11677): Remove theme check when shapes are defined for all themes.
    if (theme !== 'ionic') {
      return undefined;
    }

    if (shape === undefined) {
      return 'round';
    }

    return shape;
  }

  private getSize(): string | undefined {
    const theme = getIonTheme(this);
    const { size } = this;

Review comment (suggestion):
We also need to update the comment for `shouldShowClearButton` to add a third reason of when the button is shown.

```diff
/**
   * Determines whether or not the clear button should be visible onscreen.
   * Clear button should be shown if one of two conditions applies:
   * 1. `showClearButton` is set to `always`.
   * 2. `showClearButton` is set to `focus`, and the searchbar has been focused.
+   * 3. `theme` is not set `ionic`, and the searchbar has not been disabled.
   */
```

Code after:

  private shouldShowSearchIcon(): boolean {
    if (this.searchIcon === false || this.searchIcon === 'false') {
      return false;
    }

    return true;
  }

  /**
   * Determines whether or not the cancel button should be visible onscreen.
   * Cancel button should be shown if one of two conditions applies:
   * 1. `showCancelButton` is set to `always`.
   * 2. `showCancelButton` is set to `focus`, and the searchbar has been focused.
   */
  private shouldShowCancelButton(): boolean {
    if (this.showCancelButton === 'never' || (this.showCancelButton === 'focus' && !this.focused)) {
      return false;
    }

    return true;
  }

  /**
   * Determines whether or not the clear button should be visible onscreen.
   * Clear button should be shown if one of two conditions applies:
   * 1. `showClearButton` is set to `always`.
   * 2. `showClearButton` is set to `focus`, and the searchbar has been focused.
   * Unless the `theme` is `ionic` and the searchbar is disabled.
   */
  private shouldShowClearButton(): boolean {
    const theme = getIonTheme(this);

    if (this.showClearButton === 'never' || (this.showClearButton === 'focus' && !this.focused)) {
      return false;
    }

    if (theme === 'ionic' && this.disabled) {
      return false;
    }

    return true;
  }

  private getShape() {
    const theme = getIonTheme(this);
    const { shape } = this;

    // TODO(ROU-11677): Remove theme check when shapes are defined for all themes.
    if (theme !== 'ionic') {
      return undefined;