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

DataViews: Support "link" type in actions #68278

Open
okmttdhr opened this issue Dec 25, 2024 · 0 comments
Open

DataViews: Support "link" type in actions #68278

okmttdhr opened this issue Dec 25, 2024 · 0 comments
Labels
[Type] Enhancement A suggestion for improvement.

Comments

@okmttdhr
Copy link
Contributor

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',
}
@okmttdhr okmttdhr added the [Type] Enhancement A suggestion for improvement. label Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

1 participant