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

Commonize BasicTooltipBox #1092

Merged
merged 1 commit into from Feb 12, 2024
Merged

Commonize BasicTooltipBox #1092

merged 1 commit into from Feb 12, 2024

Conversation

igordmn
Copy link
Collaborator

@igordmn igordmn commented Feb 9, 2024

The implementation is moved from BasicTooltip.android.kt to BasicTooltipBoxInternal.kt and reused in the skiko actual. This implementation supports touch and mouse.

TooltipBox(focusable=true) doesn't have any affect after this PR, as it is incompatible with showing a tooltip hover.

Testing

manual on this example:

    @Composable
    fun Content() {
        TooltipBox(
            positionProvider = TooltipDefaults.rememberPlainTooltipPositionProvider(),
            tooltip = {
                PlainTooltip {
                    androidx.compose.material3.Text("Add to favorites")
                }
            },
            state = rememberTooltipState()
        ) {
            IconButton(
                onClick = { /* Icon button's click event */ }
            ) {
                androidx.compose.material3.Icon(
                    imageVector = Icons.Filled.Favorite,
                    contentDescription = "Localized Description"
                )
            }
        }
    }

Issues Fixed

Fixes https://kotlinlang.slack.com/archives/C01D6HTPATV/p1707322539519799
Fixes JetBrains/compose-multiplatform#3539

The implementation is moved from BasicTooltip.android.kt to BasicTooltipBoxInternal.kt and reused in skiko actual.

## Testing
manual on this example:
```
    @composable
    fun Content() {
        TooltipBox(
            positionProvider = TooltipDefaults.rememberPlainTooltipPositionProvider(),
            tooltip = {
                PlainTooltip {
                    androidx.compose.material3.Text("Add to favorites")
                }
            },
            state = rememberTooltipState()
        ) {
            IconButton(
                onClick = { /* Icon button's click event */ }
            ) {
                androidx.compose.material3.Icon(
                    imageVector = Icons.Filled.Favorite,
                    contentDescription = "Localized Description"
                )
            }
        }
    }
```
@igordmn igordmn merged commit 29bdcb7 into jb-main Feb 12, 2024
6 checks passed
@igordmn igordmn deleted the igor.demin/implement-tooltip branch February 12, 2024 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants