Skip to content

fix(BBButton): keep box size when disabled, add fullWidth and className, follow client hover tint - #99

Open
Arthurk12 wants to merge 4 commits into
bigbluebutton:developfrom
Arthurk12:issue/97+98
Open

Arthurk12 wants to merge 4 commits into
bigbluebutton:developfrom
Arthurk12:issue/97+98

Conversation

@Arthurk12

Copy link
Copy Markdown
Member

What does this PR do?

  • Disabled border: the disabled state keeps a 1px solid transparent border instead of border: none, so enabling or disabling a button no longer changes its size by 2px.
  • Disabled background fallback: replaces the invalid background-color: none with transparent. That branch can't be reached with the current disabled palette.
  • fullWidth prop: new prop for the default layout. The button fills its container and its content stays centered.
  • className forwarding: className is passed to the root element of every layout, so styled(BBButton) works. It is documented as an escape hatch while the component is being adopted. style is deliberately not forwarded.
  • Neutral hover background: colorBrandAux now falls back to --color-hover-light before the base light blue. Neutral buttons follow the client's hover tint instead of staying blue. Clients that set neither variable see no change.

Closes Issue(s)

Closes #97
Closes #98

Motivation

  • With a custom style that rebrands --color-primary and --color-hover-light, the hover of neutral buttons is still blue.

More

  • className is meant to be temporary. Once BBButton is adopted in BBB, the overrides applied through styled(BBButton) can be surveyed and the recurring ones turned into native props.
  • Not covered here: the resting background of the tertiary default button (colorBackgroundBlue) and a BBBSearch icon (colorIconBlue) are still blue under a custom brand color.

A disabled BBButton renders 2px narrower and 2px shorter than the same
button enabled. The enabled style reserves a 1px transparent border when
the color has no visible border, but the disabled style sets
`border: none`. The disabled palette has no border color, so every
disabled button drops its border, and toggling `disabled` resizes the
button and moves the layout around it (e.g. the Share button in the BBB
media-sharing modal shifts its anchored modal by 2px).

Fall back to `1px solid transparent` in the disabled branch, matching
the enabled style, so the box is the same in both states.
The disabled style falls back to `background-color: none`, which is not
valid CSS and is dropped by the browser. Use `transparent`, which is
what the fallback means. The branch is unreachable with the current
disabled palette, but it should stay correct if the palette changes.
BBButton sizes itself to its label and gives consumers no way to change
that: it has no width prop and does not forward `className`, so
`styled(BBButton)` has no effect. Consumers that need a button to fill
a footer, popover or dialog row wrap it in a div and reach into it with
a `> *` child selector, which depends on the component's markup and
targets the wrong element in the stacked layout, where the root is a
wrapper div rather than the <button>.

Add a `fullWidth` prop to the default layout that makes the button fill
its container with the content still centered. It switches the button
to `display: flex` so it does not leave the inline-flex baseline gap
below it. The circle, squared and stacked layouts are fixed-size boxes,
so the prop is not offered there.

Forward `className` to the root element of every layout, so one-off
needs such as a minimum width for short labels, margins or letting a
long label wrap work through `styled(BBButton)`. It is documented as an
escape hatch while the component is being adopted: overrides stay
greppable as `styled(BBButton)`, so the recurring ones can later be
turned into native props.

`style` is deliberately not forwarded. Inline overrides add nothing that
`styled()` does not already cover, they are harder to audit, and they
would widen the public API that has to be narrowed again later.
…ound

Buttons with the neutral color take their hover background from
colorBrandAux, which falls back from --color-brand-aux straight to the
library's light brand blue (#E5EFFB). Neither the BBB client nor its
custom styles define --color-brand-aux, so a client that rebrands
through --color-primary and --color-hover-light still gets a blue hover
on every neutral button, in every variant.

Fall back to --color-hover-light before the base light blue, so the
chain becomes --color-brand-aux -> --color-hover-light ->
--color-brand-light -> #E5EFFB. The aux variable still wins when set,
clients that rebrand the hover tint get it on neutral buttons too, and
clients that set neither keep the current #E5EFFB.

This branch has not been deployed

No deployments
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.

1 participant