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

UX: Standardize cursor behavior when hovering over editors #2495

Merged
merged 6 commits into from Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion frontend-html/public/locale/localization_cs-CZ.json
Expand Up @@ -146,5 +146,6 @@
"order_columns_button": "Seřadit",
"order_columns_title": "Pořadí sloupců",
"add_new_record": "Přidat nový záznam",
"cancel_workflow_confirmation": "Opravdu chcete zrušit workflow?"
"cancel_workflow_confirmation": "Opravdu chcete zrušit workflow?",
"hold_ctrl_tool_tip": "Držte klávesu Ctrl a klikněte pro otevření odkazu"
}
3 changes: 2 additions & 1 deletion frontend-html/public/locale/localization_de-CH.json
Expand Up @@ -141,5 +141,6 @@
"column_width": "Breite",
"order_columns_button": "Sortieren",
"order_columns_title": "Spalten sortieren",
"add_new_record": "Neuer Datensatz"
"add_new_record": "Neuer Datensatz",
"hold_ctrl_tool_tip": "Ctrl-Taste gedrückt halten und klicken, um den Link zu öffnen"
}
3 changes: 2 additions & 1 deletion frontend-html/public/locale/localization_de-DE.json
Expand Up @@ -141,5 +141,6 @@
"column_width": "Breite",
"order_columns_button": "Sortieren",
"order_columns_title": "Spalten sortieren",
"add_new_record": "Neuer Datensatz"
"add_new_record": "Neuer Datensatz",
"hold_ctrl_tool_tip": "Ctrl-Taste gedrückt halten und klicken, um den Link zu öffnen"
}
3 changes: 2 additions & 1 deletion frontend-html/public/locale/localization_en-US.json
Expand Up @@ -142,5 +142,6 @@
"order_columns_button": "Order",
"order_columns_title": "Order Columns",
"add_new_record": "Add New Record",
"cancel_workflow_confirmation": "Are you sure you want to cancel the workflow?"
"cancel_workflow_confirmation": "Are you sure you want to cancel the workflow?",
"hold_ctrl_tool_tip": "Hold Ctrl and click to open link"
}
3 changes: 2 additions & 1 deletion frontend-html/public/locale/localization_fr-CH.json
Expand Up @@ -130,5 +130,6 @@
"order_columns_button": "organiser",
"order_columns_title": "organiser les colonnes",
"add_new_record": "Ajouter nouveau dossier",
"cancel_workflow_confirmation": "Êtes-vous certain de vouloir annuler le flux de travail?"
"cancel_workflow_confirmation": "Êtes-vous certain de vouloir annuler le flux de travail?",
"hold_ctrl_tool_tip": "Maintenez Ctrl enfoncé et cliquez pour ouvrir le lien"
}
Expand Up @@ -163,8 +163,10 @@ along with ORIGAM. If not, see <http://www.gnu.org/licenses/>.
}

.input {
color: var(--foreground1) !important;
cursor: text;

&:global(.isLink) {
color: var(--foreground1) !important;
cursor: pointer !important;
}
}
Expand Down
Expand Up @@ -18,10 +18,11 @@ along with ORIGAM. If not, see <http://www.gnu.org/licenses/>.
*/

import { Observer } from "mobx-react";
import React, { useContext, useEffect, useMemo } from "react";
import React, { useContext, useEffect, useMemo, useState } from "react";
import { CtxDropdownEditor } from "./DropdownEditor";
import cx from 'classnames';
import S from "gui/Components/Dropdown/Dropdown.module.scss";
import { T } from "utils/translation";

export function DropdownEditorInput(props: {
backgroundColor?: string;
Expand All @@ -31,6 +32,7 @@ export function DropdownEditorInput(props: {
const beh = useContext(CtxDropdownEditor).behavior;
const data = useContext(CtxDropdownEditor).editorData;
const setup = useContext(CtxDropdownEditor).setup;
const [ctrlKeyPressed, setCtrlKeyPressed] = useState<boolean>(false);
const refInput = useMemo(() => {
return (elm: any) => {
beh.refInputElement(elm);
Expand Down Expand Up @@ -60,12 +62,22 @@ export function DropdownEditorInput(props: {
}
}

document.addEventListener('keydown', function(event) {
if (event.ctrlKey)
setCtrlKeyPressed(true)
});

document.addEventListener('keyup', function(event) {
if (!event.ctrlKey)
setCtrlKeyPressed(false)
});

return (
<Observer>
{() => (
<input
className={cx("input", S.input, {isLink: setup.isLink})}
className={cx("input", S.input, (ctrlKeyPressed && setup.isLink) ? ["isLink", S.isLink] : "")}
title={setup.isLink ? T("Hold Ctrl and click to open link", "hold_ctrl_tool_tip") : ""}
readOnly={beh.isReadOnly}
ref={refInput}
placeholder={data.isResolving ? "Loading..." : ""}
Expand Down
2 changes: 1 addition & 1 deletion model-tests/model/Widgets/Menu/Menu.origam
Expand Up @@ -211,7 +211,7 @@
<frmi:MenuItem
asi:abstract="false"
frmi:autoSaveOnListRecordChange="false"
ami:displayName="Dropdown Search By First ColumnO nly"
ami:displayName="Dropdown Search By First Column Only"
x:id="d28dfa42-c298-4705-9ba6-c3e88c15abd0"
asi:name="WidgetDropdownTest_MultiColumn_SearchByFirstColumnOnly"
ami:openExclusively="false"
Expand Down