Skip to content

Conversation

@jakeroseman
Copy link
Member

No description provided.

@snippet-bot
Copy link

snippet-bot bot commented Oct 9, 2024

Here is the summary of changes.

You are about to add 2 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

TopAppBar(
title = { Text(text = "Basic menu example") },
actions = {
IconButton(onClick = { shouldDisplayMenu = !shouldDisplayMenu }) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend adding a second action, thereby making it clearer that the IconButton+DropdownMenu should be wrapped by a Box to correctly set the anchor for the DropdownMenu:

        actions = {
            IconButton(onClick = { shouldDisplayMenu = !shouldDisplayMenu }) {
                Icon(Icons.Default.StarOutline, stringResource( R.string.cd_star))
            }

            Box {
                IconButton(onClick = { shouldDisplayMenu = !shouldDisplayMenu }) {
                    Icon(Icons.Default.MoreVert, stringResource(R.string.cd_more_options))
                }
                DropdownMenu(
                    expanded = shouldDisplayMenu,
                    onDismissRequest = { shouldDisplayMenu = false }
                ) {
                  DropdownMenuItem(
                      text = { Text("Refresh") },
                      onClick = { /* Handle refresh! */ }
                  )
                  DropdownMenuItem(
                      text = { Text("Settings") },
                      onClick = { /* Handle settings! */ }
                  )
                }
            }

title = { Text(text = "Basic menu example") },
actions = {
IconButton(onClick = { shouldDisplayMenu = !shouldDisplayMenu }) {
Icon(Icons.Default.MoreVert, "Overflow menu button")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Content description should describe the action. Change to "More options".

modifier = Modifier.fillMaxWidth(),
label = { Text("Select an option") },
trailingIcon = {
IconButton(onClick = { expanded = true }) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you want the whole text field to be clickable, not just the arrow?

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.

3 participants