Skip to content

Commit 4f81b4c

Browse files
committed
Settings button: spawned tooltip includes shortcut
1 parent dd22a06 commit 4f81b4c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

buttons-init-and-render.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,13 @@ window.MaxExtensionButtonsInit = {
138138
} else { // 'custom' button type
139139
if (def.config.text === SETTINGS_BUTTON_MAGIC_TEXT) {
140140
// Special handling for the settings button.
141-
const settingsButtonConfig = { ...def.config, text: 'Settings' };
141+
const settingsButtonConfig = { ...def.config, text: 'Settings', tooltip: 'Open extension settings in a new tab' };
142142
const settingsClickHandler = () => {
143143
// Send a message to the service worker to open the settings page.
144144
// This avoids the popup blocker (ERR_BLOCKED_BY_CLIENT).
145145
chrome.runtime.sendMessage({ type: 'openSettingsPage' });
146146
};
147147
buttonElement = MaxExtensionButtons.createCustomSendButton(settingsButtonConfig, index, settingsClickHandler, shortcutKey);
148-
buttonElement.title = 'Open extension settings in a new tab';
149148
} else {
150149
buttonElement = MaxExtensionButtons.createCustomSendButton(def.config, index, processCustomSendButtonClick, shortcutKey);
151150
}

buttons.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,9 @@ window.MaxExtensionButtons = {
189189
const autoSendDescription = buttonConfig.autoSend ? ' (Auto-sends)' : '';
190190
const shortcutDescription = assignedShortcutKey !== null ? ` (Shortcut: Alt+${assignedShortcutKey === 10 ? 0 : assignedShortcutKey})` : '';
191191

192-
// Set the tooltip (title attribute) combining the button text with auto-send and shortcut info
193-
customButtonElement.setAttribute('title', `${buttonConfig.text}${autoSendDescription}${shortcutDescription}`);
192+
// Set the tooltip (title attribute) combining the button text (or a custom tooltip) with auto-send and shortcut info
193+
const baseTooltipText = buttonConfig.tooltip || buttonConfig.text;
194+
customButtonElement.setAttribute('title', `${baseTooltipText}${autoSendDescription}${shortcutDescription}`);
194195

195196
customButtonElement.style.cssText = `
196197
background-color: transparent;

0 commit comments

Comments
 (0)