Skip to content

Commit 1adfe7b

Browse files
committed
Revert "Navigation history dropdowns (FreeTubeApp#5227)"
This reverts commit 0eb8271. Incompatible with Electron 26
1 parent 58c74f0 commit 1adfe7b

File tree

18 files changed

+85
-317
lines changed

18 files changed

+85
-317
lines changed

src/constants.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ const IpcChannels = {
55
OPEN_EXTERNAL_LINK: 'open-external-link',
66
GET_SYSTEM_LOCALE: 'get-system-locale',
77
GET_PICTURES_PATH: 'get-pictures-path',
8-
GET_NAV_HISTORY_ENTRY_TITLE_AT_INDEX: 'get-navigation-history-entry-at-index',
9-
GET_NAV_HISTORY_ACTIVE_INDEX: 'get-navigation-history-active-index',
10-
GET_NAV_HISTORY_LENGTH: 'get-navigation-history-length',
11-
GO_TO_NAV_HISTORY_OFFSET: 'go-to-navigation-history-index',
128
SHOW_OPEN_DIALOG: 'show-open-dialog',
139
SHOW_SAVE_DIALOG: 'show-save-dialog',
1410
STOP_POWER_SAVE_BLOCKER: 'stop-power-save-blocker',

src/main/index.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -897,26 +897,6 @@ function runApp() {
897897
session.defaultSession.closeAllConnections()
898898
})
899899

900-
// #region navigation history
901-
902-
ipcMain.on(IpcChannels.GO_TO_NAV_HISTORY_OFFSET, ({ sender }, offset) => {
903-
sender.navigationHistory.goToOffset(offset)
904-
})
905-
906-
ipcMain.handle(IpcChannels.GET_NAV_HISTORY_ENTRY_TITLE_AT_INDEX, async ({ sender }, index) => {
907-
return sender.navigationHistory.getEntryAtIndex(index)?.title
908-
})
909-
910-
ipcMain.handle(IpcChannels.GET_NAV_HISTORY_ACTIVE_INDEX, async ({ sender }) => {
911-
return sender.navigationHistory.getActiveIndex()
912-
})
913-
914-
ipcMain.handle(IpcChannels.GET_NAV_HISTORY_LENGTH, async ({ sender }) => {
915-
return sender.navigationHistory.length()
916-
})
917-
918-
// #endregion navigation history
919-
920900
ipcMain.handle(IpcChannels.OPEN_EXTERNAL_LINK, (_, url) => {
921901
if (typeof url === 'string') {
922902
let parsedURL

src/renderer/App.js

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ export default defineComponent({
9797
externalPlayer: function () {
9898
return this.$store.getters.getExternalPlayer
9999
},
100-
101100
defaultInvidiousInstance: function () {
102101
return this.$store.getters.getDefaultInvidiousInstance
103102
},
@@ -145,10 +144,6 @@ export default defineComponent({
145144
return this.$store.getters.getExternalLinkHandling
146145
},
147146

148-
appTitle: function () {
149-
return this.$store.getters.getAppTitle
150-
},
151-
152147
openDeepLinksInNewWindow: function () {
153148
return this.$store.getters.getOpenDeepLinksInNewWindow
154149
}
@@ -163,11 +158,10 @@ export default defineComponent({
163158
secColor: 'checkThemeSettings',
164159

165160
locale: 'setLocale',
166-
167-
appTitle: 'setDocumentTitle'
168161
},
169162
created () {
170163
this.checkThemeSettings()
164+
this.setWindowTitle()
171165
this.setLocale()
172166
},
173167
mounted: function () {
@@ -213,16 +207,10 @@ export default defineComponent({
213207
if (this.$router.currentRoute.path === '/') {
214208
this.$router.replace({ path: this.landingPage })
215209
}
216-
217-
this.setWindowTitle()
218210
})
219211
})
220212
},
221213
methods: {
222-
setDocumentTitle: function(value) {
223-
document.title = value
224-
this.$nextTick(() => this.$refs.topNav?.setActiveNavigationHistoryEntryTitle(value))
225-
},
226214
checkThemeSettings: function () {
227215
const theme = {
228216
baseTheme: this.baseTheme || 'dark',
@@ -551,7 +539,7 @@ export default defineComponent({
551539

552540
setWindowTitle: function() {
553541
if (this.windowTitle !== null) {
554-
this.setAppTitle(this.windowTitle)
542+
document.title = this.windowTitle
555543
}
556544
},
557545

@@ -574,7 +562,6 @@ export default defineComponent({
574562
'getExternalPlayerCmdArgumentsData',
575563
'fetchInvidiousInstances',
576564
'fetchInvidiousInstancesFromFile',
577-
'setAppTitle',
578565
'setRandomCurrentInvidiousInstance',
579566
'setupListenersToSyncWindows',
580567
'updateBaseTheme',

src/renderer/components/ft-icon-button/ft-icon-button.js

Lines changed: 15 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import { defineComponent, nextTick } from 'vue'
22
import FtPrompt from '../ft-prompt/ft-prompt.vue'
33
import { sanitizeForHtmlId } from '../../helpers/accessibility'
44

5-
const LONG_CLICK_BOUNDARY_MS = 500
6-
75
export default defineComponent({
86
name: 'FtIconButton',
97
components: {
@@ -57,27 +55,21 @@ export default defineComponent({
5755
dropdownOptions: {
5856
// Array of objects with these properties
5957
// - type: ('labelValue'|'divider', default to 'labelValue' for less typing)
60-
// - label: String (if type === 'labelValue')
61-
// - value: String (if type === 'labelValue')
62-
// - (OPTIONAL) active: Number (if type === 'labelValue')
58+
// - label: String (if type == 'labelValue')
59+
// - value: String (if type == 'labelValue')
6360
type: Array,
6461
default: () => { return [] }
6562
},
6663
dropdownModalOnMobile: {
6764
type: Boolean,
6865
default: false
69-
},
70-
openOnRightOrLongClick: {
71-
type: Boolean,
72-
default: false
7366
}
7467
},
7568
emits: ['click', 'disabled-click'],
7669
data: function () {
7770
return {
7871
dropdownShown: false,
79-
blockLeftClick: false,
80-
longPressTimer: null,
72+
mouseDownOnIcon: false,
8173
useModal: false
8274
}
8375
},
@@ -99,24 +91,14 @@ export default defineComponent({
9991
this.dropdownShown = false
10092
},
10193

102-
handleIconClick: function (e, isRightOrLongClick = false) {
94+
handleIconClick: function () {
10395
if (this.disabled) {
10496
this.$emit('disabled-click')
10597
return
10698
}
107-
108-
if (this.blockLeftClick) {
109-
return
110-
}
111-
112-
if (this.longPressTimer != null) {
113-
clearTimeout(this.longPressTimer)
114-
this.longPressTimer = null
115-
}
116-
117-
if ((!this.openOnRightOrLongClick || (this.openOnRightOrLongClick && isRightOrLongClick)) &&
118-
(this.forceDropdown || this.dropdownOptions.length > 0)) {
99+
if (this.forceDropdown || (this.dropdownOptions.length > 0)) {
119100
this.dropdownShown = !this.dropdownShown
101+
120102
if (this.dropdownShown && !this.useModal) {
121103
// wait until the dropdown is visible
122104
// then focus it so we can hide it automatically when it loses focus
@@ -129,38 +111,24 @@ export default defineComponent({
129111
}
130112
},
131113

132-
handleIconPointerDown: function (event) {
133-
if (!this.openOnRightOrLongClick) { return }
134-
if (event.button === 2) { // right button click
135-
this.handleIconClick(null, true)
136-
} else if (event.button === 0) { // left button click
137-
this.longPressTimer = setTimeout(() => {
138-
this.handleIconClick(null, true)
139-
140-
// prevent a long press that ends on the icon button from firing the handleIconClick handler
141-
window.addEventListener('pointerup', this.preventButtonClickAfterLongPress, { once: true })
142-
window.addEventListener('pointercancel', () => {
143-
window.removeEventListener('pointerup', this.preventButtonClickAfterLongPress)
144-
}, { once: true })
145-
}, LONG_CLICK_BOUNDARY_MS)
114+
handleIconMouseDown: function () {
115+
if (this.disabled) { return }
116+
if (this.dropdownShown) {
117+
this.mouseDownOnIcon = true
146118
}
147119
},
148120

149-
// prevent the handleIconClick handler from firing for an instant
150-
preventButtonClickAfterLongPress: function () {
151-
this.blockLeftClick = true
152-
setTimeout(() => { this.blockLeftClick = false }, 0)
153-
},
154-
155121
handleDropdownFocusOut: function () {
156-
if (this.dropdownShown && !this.$refs.ftIconButton.matches(':focus-within')) {
122+
if (this.mouseDownOnIcon) {
123+
this.mouseDownOnIcon = false
124+
} else if (!this.$refs.dropdown.matches(':focus-within')) {
157125
this.dropdownShown = false
158126
}
159127
},
160128

161129
handleDropdownEscape: function () {
162-
this.dropdownShown = false
163-
this.$refs.ftIconButton.firstElementChild.focus()
130+
this.$refs.iconButton.focus()
131+
// handleDropdownFocusOut will hide the dropdown for us
164132
},
165133

166134
handleDropdownClick: function ({ url, index }) {

src/renderer/components/ft-icon-button/ft-icon-button.scss

Lines changed: 11 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
flex-flow: row wrap;
55
justify-content: space-evenly;
66
position: relative;
7-
line-height: normal;
87
user-select: none;
98
}
109

@@ -25,13 +24,12 @@
2524

2625
&:not(.disabled) {
2726
&:hover,
28-
&:focus-visible,
29-
&.pressed {
27+
&:focus-visible {
3028
background-color: var(--side-nav-hover-color);
3129
color: var(--side-nav-hover-text-color);
3230
}
3331

34-
&.active {
32+
&:active {
3533
background-color: var(--side-nav-active-color);
3634
color: var(--side-nav-active-text-color);
3735
}
@@ -40,13 +38,12 @@
4038

4139
&.base-no-default:not(.disabled) {
4240
&:hover,
43-
&:focus-visible,
44-
&.pressed {
41+
&:focus-visible {
4542
background-color: var(--side-nav-hover-color);
4643
color: var(--side-nav-hover-text-color);
4744
}
4845

49-
&.active {
46+
&:active {
5047
background-color: var(--side-nav-active-color);
5148
color: var(--side-nav-active-text-color);
5249
}
@@ -58,12 +55,11 @@
5855

5956
&:not(.disabled) {
6057
&:hover,
61-
&:focus-visible,
62-
&.pressed {
58+
&:focus-visible {
6359
background-color: var(--primary-color-hover);
6460
}
6561

66-
&.active {
62+
&:active {
6763
background-color: var(--primary-color-active);
6864
}
6965
}
@@ -76,12 +72,11 @@
7672

7773
&:not(.disabled) {
7874
&:hover,
79-
&:focus-visible,
80-
&.pressed {
75+
&:focus-visible {
8176
background-color: var(--accent-color-hover);
8277
}
8378

84-
&.active {
79+
&:active {
8580
background-color: var(--accent-color-active);
8681
}
8782
}
@@ -93,12 +88,11 @@
9388

9489
&:not(.disabled) {
9590
&:hover,
96-
&:focus-visible,
97-
&.pressed {
91+
&:focus-visible {
9892
background-color: var(--destructive-hover-color);
9993
}
10094

101-
&.active {
95+
&:active {
10296
background-color: var(--destructive-active-color);
10397
}
10498
}
@@ -156,17 +150,6 @@
156150
padding: 0;
157151
}
158152

159-
:has(.active) {
160-
.checkmarkColumn {
161-
min-inline-size: 12px;
162-
}
163-
164-
.listItem {
165-
display: flex;
166-
gap: 6px;
167-
}
168-
}
169-
170153
.listItem {
171154
cursor: pointer;
172155
margin: 0;
@@ -176,20 +159,12 @@
176159
white-space: nowrap;
177160

178161
&:hover,
179-
&:focus-visible,
180-
&.pressed,
181-
&.active {
162+
&:focus-visible {
182163
background-color: var(--side-nav-hover-color);
183164
color: var(--side-nav-hover-text-color);
184165
transition: background 0.2s ease-in;
185166
}
186167

187-
&.active {
188-
font-weight: 600;
189-
display: flex;
190-
gap: 6px;
191-
}
192-
193168
&:active {
194169
background-color: var(--side-nav-active-color);
195170
color: var(--side-nav-active-text-color);

0 commit comments

Comments
 (0)