diff --git a/flow-server/src/main/resources/com/vaadin/flow/server/frontend/Flow.tsx b/flow-server/src/main/resources/com/vaadin/flow/server/frontend/Flow.tsx
index a96949bfd32..df2fa59b7c8 100644
--- a/flow-server/src/main/resources/com/vaadin/flow/server/frontend/Flow.tsx
+++ b/flow-server/src/main/resources/com/vaadin/flow/server/frontend/Flow.tsx
@@ -14,7 +14,6 @@
* the License.
*/
///
-import { nanoid } from 'nanoid';
import { Flow as _Flow } from 'Frontend/generated/jar-resources/Flow.js';
import React, { useCallback, useEffect, useReducer, useRef, useState, type ReactNode } from 'react';
import { matchRoutes, useBlocker, useLocation, useNavigate, type NavigateOptions, useHref } from 'react-router';
@@ -327,7 +326,7 @@ function Flow() {
(event: CustomEvent) => {
event.preventDefault();
- const key = nanoid();
+ const key = Math.random().toString(36).slice(2);
dispatchPortalAction(
addFlowPortal(