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

[Android] [Overflow Actions] Fix - Secondary Actions not rendered properly without primary actions #6319

Merged
merged 2 commits into from
Sep 16, 2021
Merged

[Android] [Overflow Actions] Fix - Secondary Actions not rendered properly without primary actions #6319

merged 2 commits into from
Sep 16, 2021

Conversation

karthikgopal36
Copy link
Contributor

@karthikgopal36 karthikgopal36 commented Sep 13, 2021

Description

A card has only secondary actions without any primary actions is not rendering correctly. This issue happens only if any one of the secondary action is a ShowCard action type.

Fix

There may be a case where Secondary Actions can exist without Primary Actions, so to fix that size check is removed for Primary Actions. This ensures that the action layout container is added for Secondary Actions even.

Sample Card

{
  "type": "AdaptiveCard",
  "body": [
	{
	  "size": "large",
	  "text": "Overflow Action Test Card",
	  "weight": "bolder",
	  "type": "TextBlock"
	},
	{
	  "text": "ActionSet **all secondary actions**",
	  "type": "TextBlock"
	},
	{
	  "actions": [
		{
		  "data": {
			"key": "Submit from overflow menu"
		  },
		  "title": "Action Submit",
		  "mode": "secondary",
		  "type": "Action.Submit"
		},
		{
		  "url": "https://github.com/Microsoft/AdaptiveCards",
		  "title": "OpenUrl",
		  "iconUrl": "https://urlp.asm.skype.com/v1/url/content?url=https%3a%2f%2fwww.clipartmax.com%2fpng%2ffull%2f211-2118815_file-novosel-mushroom-svg-mario-mushroom-icon.png",
		  "mode": "secondary",
		  "type": "Action.OpenUrl"
		},
		{
		  "card": {
			"type": "AdaptiveCard",
			"body": [
			  {
				"text": "What do you think?",
				"type": "TextBlock"
			  }
			],
			"actions": [
			  {
				"title": "Neat!",
				"type": "Action.Submit"
			  }
			]
		  },
		  "title": "Action.ShowCard",
		  "mode": "secondary",
		  "type": "Action.ShowCard"
		}
	  ],
	  "type": "ActionSet"
	},
	{
	  "text": "ActionSet **primary + secondary actions**",
	  "type": "TextBlock"
	},
	{
	  "actions": [
		{
		  "data": {
			"key": "View"
		  },
		  "title": "View",
		  "type": "Action.Submit"
		},
		{
		  "data": {
			"key": "Edit"
		  },
		  "title": "Edit",
		  "mode": "secondary",
		  "type": "Action.Submit"
		},
		{
		  "data": {
			"key": "Delete"
		  },
		  "title": "Delete",
		  "mode": "secondary",
		  "type": "Action.Submit"
		}
	  ],
	  "type": "ActionSet"
	},
	{
	  "text": "========= I am bottom line of body =========",
	  "type": "TextBlock"
	}
  ],
  "actions": [
	{
	  "url": "https://adaptivecards.io",
	  "title": "OpenUrl 1",
	  "type": "Action.OpenUrl"
	},
	{
	  "data": {
		"key": "Submit from overflow menu"
	  },
	  "title": "Action Submit",
	  "mode": "secondary",
	  "type": "Action.Submit"
	},
	{
	  "url": "https://github.com/Microsoft/AdaptiveCards",
	  "title": "OpenUrl",
	  "iconUrl": "https://urlp.asm.skype.com/v1/url/content?url=https%3a%2f%2fwww.clipartmax.com%2fpng%2ffull%2f211-2118815_file-novosel-mushroom-svg-mario-mushroom-icon.png",
	  "mode": "secondary",
	  "type": "Action.OpenUrl"
	},
	{
	  "card": {
		"type": "AdaptiveCard",
		"body": [
		  {
			"text": "What do you think?",
			"type": "TextBlock"
		  }
		],
		"actions": [
		  {
			"title": "Neat!",
			"type": "Action.Submit"
		  }
		]
	  },
	  "title": "Action.ShowCard",
	  "mode": "secondary",
	  "type": "Action.ShowCard"
	}
  ],
  "version": "1.5"
}

How Verified

Please refer below after and before screenshots.
In the first action set ("Action Set : all Secondary Actions") elements, Action.ShowCard should be under OverflowAction button and should not be shown as primary action.

Before After
Screenshot_1631568077 Screenshot_1631568017
Microsoft Reviewers: Open in CodeFlow

Copy link
Member

@paulcam206 paulcam206 left a comment

Choose a reason for hiding this comment

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

:shipit:

@almedina-ms almedina-ms merged commit ce47f49 into microsoft:main Sep 16, 2021
michaelfarnsworth pushed a commit to michaelfarnsworth/AdaptiveCards that referenced this pull request Nov 10, 2022
… without primary. (microsoft#6319)

Co-authored-by: almedina-ms <35784165+almedina-ms@users.noreply.github.com>
rankush pushed a commit to rankush/AdaptiveCards that referenced this pull request May 8, 2024
… without primary. (microsoft#6319)

Co-authored-by: almedina-ms <35784165+almedina-ms@users.noreply.github.com>
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.

None yet

3 participants