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: apply hover effects anywhere on the component #3796

Merged
merged 6 commits into from
Jul 24, 2023

Conversation

GZolla
Copy link
Contributor

@GZolla GZolla commented Jun 29, 2023

Apply the input hover effects when hovering over anywhere on the component, not just the input or label.
Rally: US148080

@github-actions
Copy link
Contributor

Thanks for the PR! 🎉

We've deployed an automatic preview for this PR - you can see your changes here:

URL https://pr-3796-brightspace-ui-core.d2l.dev/

Note
The build needs to finish before your changes are deployed.
Changes to the PR will automatically update the instance.

@GZolla GZolla marked this pull request as ready for review June 29, 2023 19:11
@GZolla GZolla requested a review from a team as a code owner June 29, 2023 19:11
@github-actions
Copy link
Contributor

Visual diff tests failed - pull request #3802 has been opened with the updated goldens.

border-width: 2px;
outline-style: none;
outline-width: 0;
padding: var(--d2l-input-padding-focus, calc(0.4rem - 1px) calc(0.75rem - 1px));
}
:host(:hover) .d2l-input:not([aria-invalid="true"]),
Copy link
Contributor

Choose a reason for hiding this comment

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

Targeting :host(:hover) assumes that the consumer of these styles is a simple input component wrapper, not a component composed of multiple elements. I didn't dig into them but it does appear that app components are also consuming inputStyles directly. I think we need to assume they could be pulling those styles into a huge component composed of lots of different things, possibly even multiple inputs. Even if those cases are "ok" with this change, this does still make me feel a bit uneasy. I think it would be better if there was an element that we could target that would isolate this behaviour, like one of the wrapper divs. 🤔

Copy link
Member

Choose a reason for hiding this comment

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

Agreed. These input styles are intended to be used standalone on a <input class="d2l-input"> and as Dave mentioned the "host" may be a much larger component composed of many different things.

I think if we want to do this it'll have to be something constrained to <d2l-input-text>, which is the thing that knows about the label. We may need to programatically add/remove a .d2l-input-hover CSS class when the host is hovered/blurred, and then add CSS here to handle it -- similar to how this already understands .d2l-input-focus.

components/inputs/input-textarea.js Outdated Show resolved Hide resolved
components/inputs/input-textarea.js Outdated Show resolved Hide resolved
components/inputs/input-text.js Show resolved Hide resolved
components/inputs/input-text.js Outdated Show resolved Hide resolved
@GZolla GZolla merged commit b81e832 into main Jul 24, 2023
5 checks passed
@GZolla GZolla deleted the gzolla/input-text-hover branch July 24, 2023 17:24
@ghost
Copy link

ghost commented Jul 24, 2023

🎉 This PR is included in version 2.136.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@ghost ghost added the released label Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants