Skip to content

DataViews: Support "link" type in actions #68278

@okmttdhr

Description

@okmttdhr

What problem does this address?

Currently, DataViews actions support handling user interactions. However, no explicit support exists for a "link" type that can enable navigation without custom implementations, such as;

{
				id: 'open-foo-link',
				label: __( 'Foo' ),
				callback: () => {
					window.location.href = `https://example.com/foo`;
				},
}

This can lead to inconsistent behavior, such as broken native browser interactions for cmd+click, ctrl+click, and middle-click. This also impacts accessibility and increases complexity when a native tag could easily handle these use cases.

What is your proposed solution?

Adding a "link" type here

export type Action< Item > = ActionModal< Item > | ActionButton< Item >;
would align with web standards and ensure native browser behavior is respected.

{
  type: 'link',
  href: 'https://example.com',
  label: 'Go to Example',
  target: '_blank',
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] DataViewsWork surrounding upgrading and evolving views in the site editor and beyond[Type] EnhancementA suggestion for improvement.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions