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

Add focus styles to FileInput #6950

Merged
merged 2 commits into from
Aug 29, 2024
Merged

Add focus styles to FileInput #6950

merged 2 commits into from
Aug 29, 2024

Conversation

ggdouglas
Copy link
Contributor

@ggdouglas ggdouglas commented Aug 26, 2024

Fixes #6859

Checklist

  • [N/A] Includes tests
  • [N/A] Update documentation

Changes proposed in this pull request:

Add visual focus styles to FileInput to match other input components.

Reviewers should focus on:

Screenshot

Focus (light mode)
Before After
before after
Focus (dark mode)
Before After
before after

Screenshot 2024-08-26 at 10 11 32

@changelog-app
Copy link

changelog-app bot commented Aug 26, 2024

Generate changelog in packages/core/changelog/@unreleased

What do the change types mean?
  • feature: A new feature of the service.
  • improvement: An incremental improvement in the functionality or operation of the service.
  • fix: Remedies the incorrect behaviour of a component of the service in a backwards-compatible way.
  • break: Has the potential to break consumers of this service's API, inclusive of both Palantir services
    and external consumers of the service's API (e.g. customer-written software or integrations).
  • deprecation: Advertises the intention to remove service functionality without any change to the
    operation of the service itself.
  • manualTask: Requires the possibility of manual intervention (running a script, eyeballing configuration,
    performing database surgery, ...) at the time of upgrade for it to succeed.
  • migration: A fully automatic upgrade migration task with no engineer input required.

Note: only one type should be chosen.

How are new versions calculated?
  • ❗The break and manual task changelog types will result in a major release!
  • 🐛 The fix changelog type will result in a minor release in most cases, and a patch release version for patch branches. This behaviour is configurable in autorelease.
  • ✨ All others will result in a minor version release.

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Add focus styles to FileInput

Check the box to generate changelog(s)

  • Generate changelog entry

@svc-palantir-github
Copy link

Add focus state styles to file input

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

@ggdouglas ggdouglas force-pushed the gdouglas/file-input-focus branch from 8bf4fa5 to c50a4a4 Compare August 26, 2024 18:59
@svc-palantir-github
Copy link

Add focus state styles to file input

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

Comment on lines +68 to +76
&:focus + .#{$ns}-file-upload-input {
box-shadow: input-transition-shadow($input-shadow-color-focus, true),
$input-box-shadow-focus;

.#{$ns}-dark & {
box-shadow: dark-input-transition-shadow($dark-input-shadow-color-focus, true),
$pt-dark-input-box-shadow;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

is this a paired down version of the pt-input-intent mixin? maybe we could comment that if so to at least loosely link these

also wondering if we should be using the same 2px found in that mixin for consistency? is there a reason these should be different?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The box shadows here were pulled from the base pt-input mixin:

&:focus,
&.#{$ns}-active {
box-shadow: input-transition-shadow($input-shadow-color-focus, true), $input-box-shadow-focus;
}
@function input-transition-shadow(
$color: $input-shadow-color-focus,
$focus: false,
$outer-shadow-focus-width: 1px,
) {
@if $focus {
@return
inset border-shadow(0.752, $color, 1px),
border-shadow(0.752, $color, $outer-shadow-focus-width);
} @else {
@return
border-shadow(0, $color, 0),
border-shadow(0, $color, 0);
}
}
@function border-shadow($alpha, $color: $black, $size: 1px) {
@return 0 0 0 $size rgba($color, $alpha);
}
// avoids edge blurriness for light theme focused default input
// second box-shadow of $pt-input-box-shadow
$input-box-shadow-focus: inset 0 1px 1px rgba($black, $pt-drop-shadow-opacity) !default;

and the base pt-dark-input mixin:
&:focus {
box-shadow: dark-input-transition-shadow($dark-input-shadow-color-focus, true);
}
@function dark-input-transition-shadow(
$color: $dark-input-shadow-color-focus,
$focus: false,
$outer-shadow-focus-width: 1px,
) {
@if $focus {
@return
inset border-shadow(0.752, $color, 1px),
border-shadow(0.752, $color, $outer-shadow-focus-width);
} @else {
@return
border-shadow(0, $color, 0),
border-shadow(0, $color, 0);
}
}

The default focus box shadow on input groups without an intent appears to be 2px total (1px inset + 1px).
Screenshot 2024-08-28 at 11 10 20@2x

For input groups with an intent, it appears to be 3px (1px inset + 2px)
Screenshot 2024-08-28 at 11 10 11@2x

I chose to go with the non-intent style box shadow for file input since it currently does not have the ability to have our intent styles applied. I do think it's a bit odd that the default, non-intent focus outline doesn't match the width of the focused outlines. Perhaps that's something to address in a FLUP? For now, I can comment to reference where these are coming from.

Copy link
Contributor

Choose a reason for hiding this comment

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

I do think it's a bit odd that the default, non-intent focus outline doesn't match the width of the focused outlines.

ahh nice catch - I just recently updated these focus styles. looking back at this comment: #6854 (comment) I'm seeing originally I used a lighter color for the 2px which then became the same color (and a that point I probably just missed keeping it consistent at 2px)

Copy link
Contributor

Choose a reason for hiding this comment

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

oh - maybe I did that because it already starts out with the 1px colored border when not focused

agreed without intent it makes sense for this to just be the 2px focus state!

@svc-palantir-github
Copy link

Add comment

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

@ggdouglas ggdouglas merged commit 39f0a83 into develop Aug 29, 2024
12 of 14 checks passed
@ggdouglas ggdouglas deleted the gdouglas/file-input-focus branch August 29, 2024 21:05
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.

FileInput has no visual focus state
3 participants