Skip to content

Commit 49d6f62

Browse files
committed
Revert to column-reverse except on firefox. (closes #70)
1 parent fbd9930 commit 49d6f62

File tree

4 files changed

+19
-48
lines changed

4 files changed

+19
-48
lines changed

client/src/components/MessageHistory.vue

Lines changed: 14 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<template lang="html">
2-
<section>
2+
<section :class="{ firefox: isFirefox() }">
33
<div class="history">
4-
<div id="spacer" />
54
<div
65
class="message"
76
v-for="msg in history"
@@ -12,7 +11,6 @@
1211
<Announcement v-else-if="msg.type == 'Announcement'" v-bind="msg" />
1312
<div class="text" v-else>{{ msg.text }}</div>
1413
</div>
15-
<div id="anchor" ref="anchor" />
1614
</div>
1715
</section>
1816
</template>
@@ -34,15 +32,11 @@ export default {
3432
methods: {
3533
getID(msg) {
3634
return "msg-" + msg.hash;
35+
},
36+
isFirefox() {
37+
// Browser detection of firefox
38+
return typeof InstallTrigger !== "undefined";
3739
}
38-
},
39-
mounted() {
40-
setTimeout(
41-
function() {
42-
this.$refs["anchor"].scrollIntoView();
43-
}.bind(this),
44-
50
45-
);
4640
}
4741
};
4842
</script>
@@ -54,42 +48,22 @@ export default {
5448
overflow-x: hidden;
5549
display: flex;
5650
height: 100%;
57-
flex-direction: column;
51+
flex-direction: column-reverse;
5852
}
5953
6054
.message {
6155
margin-top: $spacer;
6256
}
6357
64-
/*
65-
Problem: FireFox just doesn't scroll on a flexbox with flex-direction:column-reverse.
66-
67-
| Potential Solution | Negatives | Positives |
68-
| ----------------------------- | ---------------------------- | --------------------------- |
69-
| flex-direction:column-reverse | Doesn't work on FireFox. | Works on everything except |
70-
| on .history | | FireFox perfectly. |
71-
| ----------------------------- | ---------------------------- | --------------------------- |
72-
| transform: scaleY(-1) | Scroll direction is reversed | https://open.spotify.com/tr |
73-
| on .history and .message | (doesn't affect mobile); | ack/5foxQ24C0x7W0B2OD46AJg? |
74-
| | it's just really dumb | si=joaaiGIsTES52UQVX5bNoQ |
75-
76-
https://open.spotify.com/track/5foxQ24C0x7W0B2OD46AJg?si=joaaiGIsTES52UQVX5bNoQ
77-
.history,
78-
.message {
79-
transform: scaleY(-1);
80-
}
81-
*/
58+
.firefox {
59+
.history {
60+
flex-direction: column !important;
61+
}
8262
83-
.history * {
84-
overflow-anchor: none;
85-
}
86-
#anchor {
87-
flex: 0;
88-
min-height: 1px;
89-
overflow-anchor: auto;
90-
}
91-
#spacer {
92-
height: calc(100% - 8vmin);
63+
.history,
64+
.message {
65+
transform: scaleY(-1);
66+
}
9367
}
9468
9569
.text {

client/src/components/SidebarHistory.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ ul {
3636
padding: 0;
3737
margin: 0;
3838
display: flex;
39-
flex-direction: column;
40-
justify-content: flex-end;
39+
flex-direction: column-reverse;
4140
overflow: hidden;
4241
4342
a {

client/src/store/compose.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const actions = {
4848
console.error("No messages to copy!");
4949
return;
5050
}
51-
msg = msgs[msgs.length - 1];
51+
msg = msgs[0];
5252
window._sketch.loadImageData(msg.raw());
5353
} else {
5454
window._sketch.loadImageData(msg.raw());

client/src/store/messages.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,9 @@ const actions = {
4343

4444
const mutations = {
4545
add: (state, message) => {
46-
state.history.push(message);
47-
state.history.sort((a, b) => a.time - b.time);
48-
if (state.history.length > 32) {
49-
state.history.shift();
50-
}
46+
state.history.unshift(message);
47+
state.history.sort((a, b) => b.time - a.time);
48+
state.history.length = Math.min(state.history.length, 32);
5149
},
5250
reset: state => {
5351
state.history = [];

0 commit comments

Comments
 (0)