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

fix(Input): hide wrapper when type is hidden #1797

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

eduardo-faith
Copy link

πŸ”— Linked issue

Resolves #1784

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

In some layout, i. e. a grid with gap-4, the wrapper is still existent. Therefore there are two gaps between the previous and following visible elements.
Now the wrapping div has class 'hidden' when type="hidden". Otherwise it has the classes from ui.wrapper.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Sorry, I couldn't resist to try the PR. πŸ€“
Hope everything is according to the conventions. Don't hesitate to change anything or close the PR if I made a mistake πŸ™ˆ

Wrapper is hidden when type="hidden". Otherwise it may break the layout (i. e. when it is part of a grid with gap > 0)
Copy link

@Tarabass Tarabass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great!

I prefer class objects though for future enhancements like:

<div :class="{ 'hidden': type === 'hidden', 'ui.wrapper': type !== 'hidden' }">

But that doesn't change the behavior..

@eduardo-faith
Copy link
Author

@Tarabass Thanks! Never seen that style before, sorry. Shall I change the code to class object?

@Tarabass
Copy link

Maybe one of the maintainers can answer that. For me it doesn't matter that much :)

@benjamincanac
Copy link
Member

I'd like to ask, why use a UInput with a hidden type? It's main goal is for styling and icons, is there a reason to use it instead of a classic <input type="hidden">? πŸ€”

@eduardo-faith
Copy link
Author

@benjamincanac In my case the value of the field has to be sent to the backend via the form. But depending on a prior input of the user the field should be visible and editable.

I was using :type="..." and thought it could be mentioned.

You can close the PR if the change is not clean code! πŸ€“

@@ -1,5 +1,5 @@
<template>
<div :class="ui.wrapper">
<div :class="(type === 'hidden') ? 'hidden' : ui.wrapper">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ui.wrapper contains the relative class for absolute icons underneath, did you try with icons?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I did not style the input with icons.
As I mentioned in the description, when the UInput is part of (for example) a div.grid.gap-4 the div.relative (ui.wrapper) of UInput will cause a gap between other elements - that's the root of my PR.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But semantically you're absolutely right, there is not much sense of using a UI library for a hidden input-field - it just felt right for me to "fix" this πŸ˜…

@benjamincanac benjamincanac changed the title fix(Input): Hide wrapper when type eq hidden fix(Input): hide wrapper when type is hidden Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hide wrapper of UInput when type="hidden"
4 participants