Skip to content

Remove shadow from ion-input #17020

Closed
Closed

Description

@paulstelzer

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:

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

  1. added
    type: feature request
    and removed on Jan 9, 2019
  2. KevinKelchen commented on Jan 9, 2019

    @KevinKelchen

    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 input and textarea elements. 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-textarea and use a native textarea instead. 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. 🙂

  3. manucorporat commented on Jan 10, 2019

    @manucorporat
    Contributor

    @KevinKelchen i am looking at this issue right now, what was the CSS hack you are using in your Ionic 3 application?

  4. KevinKelchen commented on Jan 10, 2019

    @KevinKelchen

    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:

    input,
    textarea,
    select,
    ion-input,
    ion-textarea,
    ion-select,
    ion-toggle,
    ion-radio,
    ion-range {
      -webkit-transform: translateZ(0);
      -webkit-backface-visibility: hidden;
    }

    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! 👍

  5. manucorporat commented on Jan 10, 2019

    @manucorporat
    Contributor

    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!

  6. KevinKelchen commented on Jan 18, 2019

    @KevinKelchen

    Yes, @manucorporat, that CSS rule would need to be applied directly to the native input element inside of ion-input because the CSS consists of non-inheritable CSS properties. Same with ion-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! 👍

  7. ionitron-bot commented on Feb 17, 2019

    @ionitron-bot

    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.

  8. locked and limited conversation to collaborators on Feb 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: feature request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions