ListView Command Set command is not displayed for a list that was placed on a modern page and only 1 item is select thereed
Target SharePoint environment
SharePoint Online
What SharePoint development model, framework, SDK or API is this about?
💥 SharePoint Framework
Developer environment
Windows
What browser(s) / client(s) have you tested
- [ ] 💥 Internet Explorer
- [X] 💥 Microsoft Edge
- [X] 💥 Google Chrome
- [X] 💥 FireFox
- [ ] 💥 Safari
- [ ] mobile (iOS/iPadOS)
- [ ] mobile (Android)
- [ ] not applicable
- [ ] other (enter in the "Additional environment details" area below)
Additional environment details
- browser version
- SPFx version: 1.11.0
- Node.js version: v10.19.0
Describe the bug / error
When placing a list component into a modern page, then custom action is not displayed for the case, when the user selects only 1 item or file.
I want to show a custom action only for a specific list. In order to archive it, I have set RegistrationId="--guid (list Id)--":

There is the same behavior when I added a user custom action programmatically to SP.List.UserCustomActions.
Steps to reproduce
- Create a new list ListA on SharePoint Site.
- Add a new SPFx extension that contains one list view command set with one command ("Custom action1").
- Set RegistrationId as the ID of ListA in "/sharepoint/assets/elements.xml" file.
- Deploy SPFx extension to SharePoint site
- Go to List A and see that "Custom action1" is displayed for all cases (no items are selected, 1 item is selected, 2 items are selected)
- Add List component (ListA) to any modern page
- Select any item of ListA and see, that "Custom action1" disappeared. If you select 2 and more items, then it is visible again.
The issue is reproducible only on modern pages, it works on list views.
Here are my files:
config.json
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/config.2.0.schema.json",
"version": "2.0",
"bundles": {
"my-custom-action1": {
"components": [
{
"entrypoint": "./lib/extensions/customAction1/CustomAction1CommandSet.js",
"manifest": "./src/extensions/customAction1/CustomAction1CommandSet.manifest.json"
}
]
}
},
"externals": {}
}
CustomAction1CommandSet.ts `import { override } from '@microsoft/decorators'; import { Log } from '@microsoft/sp-core-library'; import { BaseListViewCommandSet, IListViewCommandSetListViewUpdatedParameters, IListViewCommandSetExecuteEventParameters } from '@microsoft/sp-listview-extensibility';
export interface CustomAction1CommandSetProperties { } const LOG_SOURCE: string = 'CustomAction1CommandSet';
export default class CustomAction1CommandSet extends BaseListViewCommandSet
@override
public onInit(): Promise
@override public onListViewUpdated(event: IListViewCommandSetListViewUpdatedParameters): void { //no code }
@override
public onExecute(event: IListViewCommandSetExecuteEventParameters): void {
console.log("EXECUTE");
}
}
`
CustomAction1CommandSet.manifest.json
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx/command-set-extension-manifest.schema.json",
"id": "5a49faec-74c2-46c1-bb59-b48247b4204c",
"alias": "CustomAction1CommandSet",
"componentType": "Extension",
"extensionType": "ListViewCommandSet",
"version": "*",
"manifestVersion": 2,
"requiresCustomScript": false,
"items": {
"CustomAction1": {
"title": { "default": "Custom action11" },
"type": "command"
}
}
}
Expected behavior
"Custom action1" should be visible when no items are selected, a single item is selected and multiple items are selected for list views and modern pages.
I have investigated the SharePoint code a little bit, and the issue is in IsEnabled javascript function for custom action:

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
This should be rolled out WW by now
Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues