Repository navigation
Description
Feature request / discussion
Ionic version:
[x] 4.x
Current behavior:
I wanted to start a discussion because it's a very important topic for many of us and a lot of issues (duplicated are already closed) deal with this topic.
Currently ion-input itself is inside shadow dom, also there is a native input element that is hidden and outside of the shadow dom. But unfortunately this is not working very well.
Of course shadow dom has it's benefits, but should we stay at it although it has many disadvantages? What currently with shadow dom is not working:
-
Hitting Enter on input (mobile and desktop browser) does not submit the form
-
Next Button on native app is not working because he finds no next input because the only input is hidden and the normal input is inside shadow dom which is not seen (Ionic 4 - iOS accessory bar next/previous buttons disabled using ion-item #16498 )
-
Tools like lastpass are not working ( Ionic input fields are not compatible with with lastpass #16310 )
My preference:
From my point of view ion-input and shadow dom are not good at the moment because the browsers (and webview) do not support it very well at the moment. The workaround with a hidden input is not working in an native app with an onscreen keyboard (no next button) and hitting enter does not submit the form. All in all, i would suggest to remove the shadow flag inside ion-input https://github.com/ionic-team/ionic/blob/master/core/src/components/input/input.tsx#L13
By removing shadow there need to make changes inside the scss of input, but it will work. As I said in the beginning, shadow dom has it's benefits, but on input, it has more disadvantages - from my point of view.
I just want to start a discussion, so tell me guys, what you think
PS: What about an alternative without shadow dom. So we can keep ion-input for everyone who needs shadow dom and a ion-input-native without it but with the benefits of the styles and setttings ionic offers
Activity
KevinKelchen commentedon Jan 9, 2019
This may also apply to
ion-textarea. 🙂An additional issue I should note for our application:
In v3 we worked around the issue mentioned here on iOS by using a CSS hack on
inputandtextareaelements. Now that they're in the Shadow DOM we can no longer target them (the CSS is not inheritable through the Shadow DOM boundary and there are no CSS variables for it).I've never opened an issue for this because I had difficulty reproducing it in a sample application and feared the issue would be closed without a sample app or steps to reproduce. It was far less effort to drop
ion-textareaand use a nativetextareainstead. If I should open an issue anyway without a sample/steps, please let me know.I'm not looking to discuss the issue I described within this issue. I just wanted to note that the issue exists despite not having a sample app/steps to reproduce in case it factors into the thinking of others. 🙂
manucorporat commentedon Jan 10, 2019
@KevinKelchen i am looking at this issue right now, what was the CSS hack you are using in your Ionic 3 application?
KevinKelchen commentedon Jan 10, 2019
Hi @manucorporat! 👋
This is basically the rule we are using in our Ionic 3 application to fix the issue. It also targets other elements we had issues with, but I don't remember what those specific issues were because it was a couple of years ago and handled by another team member:
The
-webkit-transform: translateZ(0);is a workaround I've found others using as well.Please let me know if you would like for me to create a separate GitHub issue and link to it here. I really appreciate you taking the time to look into it! Thank you! 👍
manucorporat commentedon Jan 10, 2019
So you want to apply this CSS directly to the input inside
ion-input?i have never been able to reproduce the issue you are talking about... but I believe it could be some rendering issue when there are several nested layers. If you can record a video and submit a new issue that might help!
Update e2e step definition for Ionic 4.0.0-rc.2's input change
KevinKelchen commentedon Jan 18, 2019
Yes, @manucorporat, that CSS rule would need to be applied directly to the native
inputelement inside ofion-inputbecause the CSS consists of non-inheritable CSS properties. Same withion-textarea.The commit which closed this issue (present in RC2) allows the CSS workaround to once again target the native elements and "fix" this issue. Hooray for that! 🎉 When I have an opportunity I can try to do as you suggest in effort to more completely address the issue. 🙂
Again, thanks for making this change! 👍
ionitron-bot commentedon Feb 17, 2019
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.