JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.33k stars 1.12k forks source link

M3 FilterChip weird highlight on desktop when hovering #2868

Open syt0r opened 1 year ago

syt0r commented 1 year ago

Describe the bug Text is not highlighted when you hover mouse over material3 version of FilterChip

Affected platforms Select one of the platforms below:

Versions

Additional context

package ua.syt0r.kanji

import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.FilterChip
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.window.Window
import androidx.compose.ui.window.application
import org.koin.core.context.loadKoinModules
import org.koin.core.context.startKoin
import ua.syt0r.kanji.presentation.common.resources.string.EnglishStrings
import ua.syt0r.kanji.presentation.common.theme.AppTheme
import ua.syt0r.kanji.presentation.screen.main.MultiplatformMainNavigation
import ua.syt0r.kanji.presentation.screen.main.rememberMultiplatformMainNavigationState

fun main(args: Array<String>) = application {
    startKoin { loadKoinModules(appModules) }
    Window(
        onCloseRequest = ::exitApplication,
        title = EnglishStrings.appName
    ) {
        App()
    }
}

@OptIn(ExperimentalMaterial3Api::class)
@Composable
private fun App() {
    FilterChip(selected = false, onClick = {}, label = { Text("Test") })
}
m-sasha commented 1 year ago

Can you provide a reproducer/example without external libraries, to make it easier for us to run it?

syt0r commented 1 year ago

Here: M3FilterChipTest.zip

m-sasha commented 1 year ago

Here's a simple reproducer:

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.FilterChip
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.window.singleWindowApplication

fun main() = singleWindowApplication {
    App2()
}

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun App2() {
    Box(Modifier.fillMaxSize()) {
        FilterChip(selected = false, onClick = {}, label = { Text("Test") })
    }
}
alexstyl commented 9 months ago

Workaround for the time being: remove the Chip's elevation by passing null to elevation:

FilterChip(
          elevation = null,
          // ....  
)