From f6fa248ac1d2e417c931a4be82acede3dde4840e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Fern=C3=A1ndez?= Date: Mon, 26 Feb 2024 12:08:00 +0100 Subject: [PATCH] ReturnToPrevious: Add guidelines to `returnToPrevious` hook (#83219) --- packages/grafana-runtime/src/utils/returnToPrevious.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/grafana-runtime/src/utils/returnToPrevious.ts b/packages/grafana-runtime/src/utils/returnToPrevious.ts index 7b699cad7b4..7810eb46c0a 100644 --- a/packages/grafana-runtime/src/utils/returnToPrevious.ts +++ b/packages/grafana-runtime/src/utils/returnToPrevious.ts @@ -6,6 +6,11 @@ export const setReturnToPreviousHook = (hook: ReturnToPreviousHook) => { rtpHook = hook; }; +/** + * Guidelines: + * - Only use the ‘Return to previous’ functionality when the user is sent to another context, such as from Alerting to a dashboard. + * - Specify a button title that identifies the page to return to in the most understandable way. Do not use text such as ‘Back to the previous page’. Be specific. + */ export const useReturnToPrevious: ReturnToPreviousHook = () => { if (!rtpHook) { if (process.env.NODE_ENV !== 'production') {