compose-multiplatform icon indicating copy to clipboard operation
compose-multiplatform copied to clipboard

Checkbox base padding too high.

Open Exidel opened this issue 4 years ago • 2 comments

When use Checkbox() as it is - it's very big empty space around checkbox. But if I add Modifier.padding(2.dp).size(20.dp) all become to normal. Any manipulations with Modifier.size() doesn't affect on checkbox size, just make padding less or higher. v1.0.0-alpha4-366. Last time I was used it with v0.5.0-262 and all was fine.

v1 v2

Code
           Column {
                for (i in 1..10) {
                    Row {
                        Checkbox(checkboxBoolean, { checkboxBoolean = !checkboxBoolean }, Modifier.padding(2.dp).size(20.dp))
                        Text("item$i", Modifier.align(Alignment.CenterVertically))
                    }
                }
            }

Exidel avatar Oct 05 '21 22:10 Exidel

There is a commit which adds additional paddings for accessibility purposes. It seems reasonable for touch devices, but probably looks too high on desktop.

I checked what are the paddings in Material design for web and in Chrome settings. Paddings are high too there.

Anyway, I think we should investigate, if it is the right approach to enforce paddings for material components on desktop.

We have two options:

  • leave additional paddings as they are now
  • make them smaller for desktop target (we need to take into account ChromeOS too)

To disable paddings, use this:

@OptIn(ExperimentalMaterialApi::class)
CompositionLocalProvider(LocalMinimumTouchTargetEnforcement provides false) {
   App()
}

igordmn avatar Nov 01 '21 20:11 igordmn

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

okushnikov avatar Aug 26 '24 16:08 okushnikov