fluentui icon indicating copy to clipboard operation
fluentui copied to clipboard

[Bug]: Checkbox uses align-items: center when using onRenderLabel

Open ilbrando opened this issue 4 years ago • 3 comments

Library

React / v8 (@fluentui/react)

System Info

System:
    OS: Windows 10 10.0.19042
    CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
    Memory: 10.22 GB / 31.38 GB
  Browsers:
    Chrome: 106.0.5249.119
    Edge: Spartan (44.19041.1266.0), Chromium (106.0.1370.42)
    Internet Explorer: 11.0.19041.1566

Are you reporting Accessibility issue?

No response

Reproduction

https://codesandbox.io/s/fluentui-checkbox-onrenderlabel-s7kcxl

Bug Description

Actual Behavior

When using onRenderLabel the label layout is having aling-items set to "center" instead of "flex-start".

The source of the problem:

 label: [
      classNames.label,
      theme.fonts.medium,
      {
        display: 'flex',
        alignItems: isUsingCustomLabelRender ? 'center' : 'flex-start',
        cursor: disabled ? 'default' : 'pointer',
        position: 'relative',
        userSelect: 'none',
      },

Code on Github

Expected Behavior

Layout to be the same as when not using onRenderLabel.

There might be a good reason for this, but at least it would be nice to be able to opt out of it and use the normal layout.

Another idea could be to allow the label to be a JSX element.

Logs

No response

Requested priority

High

Products/sites affected

No response

Are you willing to submit a PR to fix?

no

Validations

  • [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • [X] The provided reproduction is a minimal reproducible example of the bug.

ilbrando avatar Oct 14 '22 09:10 ilbrando

Hey @ilbrando, I'm unaware of why this was decided, but it can be easily opted out of via a simple style override like the one in the following modified codesandbox based on the one you attached to your issue. Let me know if that helps.

khmakoto avatar Nov 30 '22 22:11 khmakoto

This issue has been automatically marked as stale because it has marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thank you for your contributions to Fluent UI!

msft-fluent-ui-bot avatar Dec 04 '22 23:12 msft-fluent-ui-bot

Sorry I forgot to answer. The workaround solves the problem.

ilbrando avatar Dec 05 '22 08:12 ilbrando