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: Input does not support size attribute #27945

Closed
3 tasks done
clockwiser opened this issue Aug 7, 2023 · 2 comments · Fixed by #27951
Closed
3 tasks done

bug: Input does not support size attribute #27945

clockwiser opened this issue Aug 7, 2023 · 2 comments · Fixed by #27951
Labels
package: core @ionic/core package type: bug a confirmed bug report

Comments

@clockwiser
Copy link

clockwiser commented Aug 7, 2023

Prerequisites

Ionic Framework Version

v7.x

Current Behavior

The ion-input element is 100% wide and no indication of any changes when adjust the size value.

<ion-input
    class="corner"
    type="number"
    v-model="sz"
    :maxlength="1"
    :max="8"
    :min="5"
    :size="50"
    required
   placeholder="?"
   >
</ion-input>

Expected Behavior

The width of ion-input element should be 50 px as explained in the ionic doc site.

Steps to Reproduce

  1. Create a view in vue framework.
  2. In that view put codes similar to the following.
<form>
  <ion-list>
      <ion-item>
            <ion-label >
                Number of Letters
              </ion-label>
   
          <ion-input
                class="corner"
                type="number"
                v-model="sz"
                :maxlength="1"
                :max="8"
                :min="5"
                required
                placeholder="?"
              >
          </ion-input>
       </ion-item>
    </ion-list>
  </form>

Code Reproduction URL

No response

Ionic Info

ionic info

[WARN] Error loading @capacitor/ios package.json: Error: Cannot find module '@capacitor/ios/package.json'

   Require stack:
   - C:\wkvue\ioni\wordict\node_modules\@ionic\cli\lib\project\index.js
   - C:\wkvue\ioni\wordict\node_modules\@ionic\cli\lib\index.js
   - C:\wkvue\ioni\wordict\node_modules\@ionic\cli\index.js
   - C:\wkvue\ioni\wordict\node_modules\@ionic\cli\bin\ionic

Ionic:

Ionic CLI : 7.1.1
Ionic Framework : @ionic/vue 7.1.1

Capacitor:

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

Utility:

cordova-res : not installed globally
native-run : 1.7.2

System:

NodeJS : v18.13.0 (C:\Program Files\nodejs\node.exe)
npm : 8.19.3
OS : Windows 10

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Aug 7, 2023
@sean-perkins sean-perkins self-assigned this Aug 8, 2023
@sean-perkins
Copy link
Contributor

Hello @clockwiser thanks for reporting this issue!

The size attribute is not compatible with ion-input. We need to update our auto-generated documentation for this property and remove it in a major release.

ion-input currently does not use the shadow DOM, so you can target the native input directly to override any desired styling: https://stackblitz.com/edit/3c8oty?file=index.html

Input masking or maxlength may be a more suitable approach to visually limit the contents of the input, while still allowing it expand the entire container space.

@sean-perkins sean-perkins changed the title bug: size of ion-input not working bug: Input does not support size attribute Aug 8, 2023
@sean-perkins sean-perkins added package: core @ionic/core package type: bug a confirmed bug report labels Aug 8, 2023
@ionitron-bot ionitron-bot bot removed the triage label Aug 8, 2023
@sean-perkins sean-perkins removed their assignment Aug 8, 2023
github-merge-queue bot pushed a commit that referenced this issue Aug 10, 2023
Issue number: Resolves #27945 

---------

<!-- 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 `ion-input` accepts a `size` attribute that implies that it will
effect the size of the input under certain rules. This is not the case.
The `size` attribute has no effect on the size of the `input` element
since Ionic sets the input width to 100%.

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

- Removes the documentation around the `size` attribute so that it will
be removed from the Ionic Docs
- Adds a task link to remove the `size` attribute in an upcoming major
release

## 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. -->
@ionitron-bot
Copy link

ionitron-bot bot commented Sep 9, 2023

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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.

2 participants