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

feat: Support for HTML5 features for Alert Inputs #21290

Closed
cerkiner opened this issue May 13, 2020 · 3 comments
Closed

feat: Support for HTML5 features for Alert Inputs #21290

cerkiner opened this issue May 13, 2020 · 3 comments
Labels

Comments

@cerkiner
Copy link
Contributor

Feature Request

Ionic version:
[x] 5.x

Describe the Feature Request
It is necessary to add special attributes such as maxLength, inputmode, pattern, id etc. on inputs while using AlertController.

Describe Preferred Solution

Have new options for inputs to set custom attributes while creating alerts;

alert.addInput({
      name: 'pin',
      placeholder: 'Pin Code',
      type: 'password',
      maxLength: 4,
      inputmode: 'numeric',
      ...
});

Describe Alternatives

alert.present().then(v => {
   let input = (document.querySelector('ion-alert input') as any);
   if (input) {
      input.setAttribute('maxlength','4');
      input.setAttribute('inputmode','numeric');
      ...
   }
});

However, this is just a hacky workaround and it gets complicated really quickly with multiple inputs. I think Ionic team should include a feature to add custom attributes and other native HTML5 features for inputs.

@ionitron-bot ionitron-bot bot added the triage label May 13, 2020
@liamdebeasi
Copy link
Contributor

Thanks for the issue. I am going to close this as a duplicate of #21202.

@cerkiner
Copy link
Contributor Author

Oh okay. Sorry for the duplicate. I was working on this issue/improvement for some time. I checked when I started but I didn't re-check when I created the issue.

@ionitron-bot
Copy link

ionitron-bot bot commented Jun 13, 2020

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 Jun 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants