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: focus offset added for checkbox and buttons #390

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions src/assets/properties-panel.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
--color-grey-0-0-22: hsl(0, 0%, 22%);

--color-blue-205-100-35: hsl(205, 100%, 35%);
--color-blue-205-100-40: hsl(205, 100%, 40%);
--color-green-150-86-44: hsl(150, 86%, 44%);
--color-blue-205-100-45: hsl(205, 100%, 45%);
--color-blue-205-100-50: hsl(205, 100%, 50%);
--color-blue-205-100-85: hsl(205, 100%, 85%);
--color-blue-205-100-95: hsl(205, 100%, 95%);
--color-blue-219-99-53: hsl(219, 99%, 53%);
--color-blue-218-100-74: hsl(218, 100%, 74%);
--color-green-150-86-44: hsl(150, 86%, 44%);
--color-blue-205-100-85: hsl(205, 100%, 85%);
--color-blue-205-100-95: hsl(205, 100%, 95%);

--color-red-360-100-40: hsl(360, 100%, 40%);
--color-red-360-100-45: hsl(360, 100%, 45%);
Expand Down Expand Up @@ -78,6 +79,7 @@

--input-focus-background-color: var(--color-blue-205-100-95);
--input-focus-border-color: var(--color-blue-205-100-50);
--focus-outline-color: var(--color-blue-205-100-40);

--input-error-background-color: var(--color-red-360-100-97);
--input-error-border-color: var(--color-red-360-100-45);
Expand Down Expand Up @@ -299,6 +301,11 @@
background: none;
}

.bio-properties-panel-group-header-button:focus {
outline-offset: 2px;
philippfromme marked this conversation as resolved.
Show resolved Hide resolved
outline-color: var(--focus-outline-color);
}

.bio-properties-panel-group-header-buttons .bio-properties-panel-group-header-buttons:last-child {
margin-right: 0;
}
Expand Down Expand Up @@ -537,8 +544,9 @@ select.bio-properties-panel-input {
}

.bio-properties-panel-input[type="checkbox"]:focus {
outline: 2px solid var(--input-focus-border-color);
outline-offset: 0;
outline: auto;
Copy link
Contributor

@philippfromme philippfromme Dec 2, 2024

Choose a reason for hiding this comment

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

Why auto? It let's the user agent render a custom outline style. Is this what we want?

Copy link
Member

@nikku nikku Dec 2, 2024

Choose a reason for hiding this comment

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

Two directions to take here:

  • It is integrators responsibility (Desktop Modeler, Web Modeler, bpmn.io demo, ...) to decide on outline (everything or subset, i.e. "you can decide on color")
  • We offer reasonable defaults, and folks may override, i.e. to better embed in a 90s style website.

Copy link
Contributor

Choose a reason for hiding this comment

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

Then I'd expect it to be consistent. If we already set the color we should also set the style. As you said, one can always override.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree. We should maintain consistent styling across all child libraries instead of relying entirely on integrators. While we can allow them the flexibility to override styles, our defaults should not depend on their configurations.

Copy link
Contributor Author

@abdul99ahad abdul99ahad Dec 3, 2024

Choose a reason for hiding this comment

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

We've already specified the color in the same class. Using the auto property ensures an default outline is provided, overriding the none outline for inputs.

.bio-properties-panel-input:focus,
.bio-properties-panel-input:focus-within {
  outline: none;

outline-color: var(--focus-outline-color);
outline-offset: 2px;
}

.bio-properties-panel-checkbox > .bio-properties-panel-label {
Expand Down
Loading