feat: add-task usability improvements #2767

Merged
konrad merged 1 commits from dpschen/frontend:feature/improve-add-task into main 2023-01-04 15:54:10 +00:00
Member
No description provided.
dpschen added the
kind/feature
changes requested
labels 2022-11-30 14:50:32 +00:00
konrad was assigned by dpschen 2022-11-30 14:50:32 +00:00
Member

Hi dpschen!

Thank you for creating a PR!

I've deployed the changes of this PR on a preview environment under this URL: https://2767-feature-improve-add-task--vikunja-frontend-preview.netlify.app

You can use this url to view the changes live and test them out.
You will need to manually connect this to an api running somehwere. The easiest to use is https://try.vikunja.io/.

Have a nice day!

Beep boop, I'm a bot.

Hi dpschen! Thank you for creating a PR! I've deployed the changes of this PR on a preview environment under this URL: https://2767-feature-improve-add-task--vikunja-frontend-preview.netlify.app You can use this url to view the changes live and test them out. You will need to manually connect this to an api running somehwere. The easiest to use is https://try.vikunja.io/. Have a nice day! > Beep boop, I'm a bot.
dpschen force-pushed feature/improve-add-task from a6a431a126 to d6741e601a 2022-11-30 14:53:49 +00:00 Compare
dpschen reviewed 2022-11-30 14:57:07 +00:00
@ -3,7 +3,6 @@
<div class="field is-grouped">
<p class="control has-icons-left is-expanded">
<textarea
:disabled="loading || undefined"
Author
Member

You can always write in this field. But you may not be able so submit.
This makes the initial loading of the home page calmer.

You can always write in this field. But you may not be able so submit. This makes the initial loading of the home page calmer.
@ -208,0 +209,4 @@
opacity: 0;
transition: opacity $transition;
}
.task-add:has(.add-task-textarea:focus) .quick-add-magic {
Author
Member

By using :has(.add-task-textarea:focus) we check if the input has focus.

By using `:has(.add-task-textarea:focus)` we check if the input has focus.

I really like that idea, but it looks like it does not work:

image

I really like that idea, but it looks like it does not work: ![image](/attachments/a0b27f6b-70d1-4d83-b1eb-434449bcafd9)
Author
Member

Image doesn't load.

Image doesn't load.
Author
Member

Which browser?

Which browser?
Author
Member

If it's not transpiled then we still have an issue with postcss-preset-env:

https://github.com/csstools/postcss-plugins/tree/main/plugins/css-has-pseudo

If it's not transpiled then we still have an issue with postcss-preset-env: https://github.com/csstools/postcss-plugins/tree/main/plugins/css-has-pseudo

Which browser?

Firefox

> Which browser? Firefox
Author
Member

Turned out that using focus-within was the smartest solution.
Because the user should be able to tab to the "What" button.
With the :has(.add-task:focus) solution the element would be hidden when the textarea loses focus.

Turned out that using focus-within was the smartest solution. Because the user should be able to <kbd>tab</kbd> to the "What" button. With the `:has(.add-task:focus)` solution the element would be hidden when the textarea loses focus.

Seems to work now!

Seems to work now!
dpschen marked this conversation as resolved
@ -1,5 +1,5 @@
<template>
<div v-if="available">
<div v-if="available && prefixes !== undefined">
Author
Member

This is mostly for typescript, because it didn't get that prefixes won't be used if available is false.

This is mostly for typescript, because it didn't get that prefixes won't be used if available is false.
dpschen marked this conversation as resolved
dpschen requested review from konrad 2022-11-30 14:57:13 +00:00
dpschen force-pushed feature/improve-add-task from d6741e601a to a782abbc57 2022-12-07 15:32:18 +00:00 Compare
Author
Member

@konrad please recheck

@konrad please recheck
Owner

I'm wondering if we could improve the empty space here when the help text ist not shown?

image

I'm wondering if we could improve the empty space here when the help text ist not shown? ![image](/attachments/cfa30e75-fe2c-49ea-9e93-621f9edbb884)
6.0 KiB
Author
Member

I'm wondering if we could improve the empty space here when the help text ist not shown?

image

I kept that for now by intend. Reason being that I didn't want the content to jump too much when the field gets focus.
I do still have a component that animates height smoothly somewhere. We could add that at a later stage.

> I'm wondering if we could improve the empty space here when the help text ist not shown? > > ![image](/attachments/cfa30e75-fe2c-49ea-9e93-621f9edbb884) I kept that for now by intend. Reason being that I didn't want the content to jump too much when the field gets focus. I do still have a component that animates height smoothly somewhere. We could add that at a later stage.
Owner

I kept that for now by intend. Reason being that I didn't want the content to jump too much when the field gets focus.

That makes sense. Still I think we should do something about the space, it just does not look great right now

> I kept that for now by intend. Reason being that I didn't want the content to jump too much when the field gets focus. That makes sense. Still I think we should do something about the space, it just does not look great right now
Author
Member

I kept that for now by intend. Reason being that I didn't want the content to jump too much when the field gets focus.

That makes sense. Still I think we should do something about the space, it just does not look great right now

I thought about this again I'm not sure I would like the animation tbh. Reason beeing that the whole list would move up and down. Right now we show and hide this on hover. Maybe that was too much, but if we move the list up an down only when we hover it seems a bit much.

> > I kept that for now by intend. Reason being that I didn't want the content to jump too much when the field gets focus. > > That makes sense. Still I think we should do something about the space, it just does not look great right now I thought about this again I'm not sure I would like the animation tbh. Reason beeing that the whole list would move up and down. Right now we show and hide this on hover. Maybe that was too much, but if we move the list up an down only when we hover it seems a bit much.
Owner

I agree about the animation. Not sure what we could do about this instead? Maybe hide the notice completely after showing it a few times?

I agree about the animation. Not sure what we could do about this instead? Maybe hide the notice completely after showing it a few times?
Author
Member

I agree about the animation. Not sure what we could do about this instead? Maybe hide the notice completely after showing it a few times?

A user might want to look something up at a later time. Where would you find it adter it has been hidden?

> I agree about the animation. Not sure what we could do about this instead? Maybe hide the notice completely after showing it a few times? A user might want to look something up at a later time. Where would you find it adter it has been hidden?
Owner

Good point. We could just add it to the menu or help document, but I feel like there should be a better way to it.

Good point. We could just add it to the menu or help document, but I feel like there should be a better way to it.
dpschen force-pushed feature/improve-add-task from a782abbc57 to 41aba1554e 2022-12-13 17:47:24 +00:00 Compare
Author
Member

I added a collapsable now. It expands on focus somewhere in the modul or on hover with a slight delay.

I added a collapsable now. It expands on focus somewhere in the modul _or_ on hover with a slight delay.
dpschen force-pushed feature/improve-add-task from 41aba1554e to 7cdd6a3469 2022-12-13 17:53:05 +00:00 Compare
dpschen reviewed 2022-12-13 18:00:12 +00:00
@ -0,0 +10,4 @@
@after-leave="afterLeave"
@leave-cancelled="leaveCancelled"
>
<div
Author
Member

The initialHeight might be currently broken. I still kept it in since I'm not sure how to remove that in a way that makes sense.

The `initialHeight` might be currently broken. I still kept it in since I'm not sure how to remove that in a way that makes sense.
dpschen force-pushed feature/improve-add-task from 7cdd6a3469 to 63f1074681 2022-12-13 18:09:19 +00:00 Compare
dpschen reviewed 2022-12-13 18:11:49 +00:00
@ -37,3 +35,1 @@
{{ errorMessage }}
</p>
<quick-add-magic v-else/>
<Expandable :open="errorMessage !== '' || taskAddFocused || taskAddHovered && debouncedTaskAddHovered">
Author
Member

By combining taskAddHovered with debouncedTaskAddHovered we make sure that the content is shown on hover, but only if it's debounced. We make also sure that if there is no focus or error and the mouse leaves the area the content will immediately be hidden.

By combining `taskAddHovered` with `debouncedTaskAddHovered` we make sure that the content is shown on hover, but only if it's debounced. We make also sure that if there is no focus or error and the mouse leaves the area the content will immediately be hidden.
dpschen marked this conversation as resolved
dpschen reviewed 2022-12-13 18:16:30 +00:00
@ -74,0 +78,4 @@
const taskAdd = ref<HTMLTextAreaElement | null>(null)
// enable only if we don't have a modal
// onStartTyping(() => {
Author
Member

This is really cool. But I can only enable this in the moment that we have a reliable way to detect if there is a modal open. E.g. This fails currently for the quick-actions.

This is really cool. But I can only enable this in the moment that we have a reliable way to detect if there is a modal open. E.g. This fails currently for the quick-actions.
dpschen reviewed 2022-12-13 18:21:28 +00:00
@ -76,3 +95,3 @@
function resetEmptyTitleError(e) {
function resetEmptyTitleError(e: KeyboardEvent) {
if (
(e.which <= 90 && e.which >= 48 || e.which >= 96 && e.which <= 105)
Author
Member

I don't get what this does. Also which is deprecated

I don't get what this does. Also [`which` is deprecated](https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/which)

I think it resets the error message if any letter was pressed. (iirc the change event on the checkbox triggers even if you press something like esc or shift).

I think it resets the error message if any letter was pressed. (iirc the `change` event on the checkbox triggers even if you press something like esc or shift).
Author
Member

I still don't get this. This is called from a <textarea> not from a checkbox.

Also I understand where the specific values from the range come from / which keys they stand for. The range includes many more then just two codes (as implied by your "esc or shift" comment).

I still don't get this. This is called from a `<textarea>` not from a checkbox. Also I understand where the specific values from the range come from / which keys they stand for. The range includes many more then just two codes (as implied by your "esc or shift" comment).

Maybe we can actually remove this? (in a follow-up PR)

Maybe we can actually remove this? (in a follow-up PR)
dpschen reviewed 2022-12-13 18:29:00 +00:00
@ -0,0 +15,4 @@
() => window?.document.activeElement as T | null | undefined,
)
function waitForRelatedTarget(event: FocusEvent) {
Author
Member

I had to modify this since useActiveElement was always <body> in between blur and focus. That broke useFocusWithin. Made a pull request https://github.com/vueuse/vueuse/pull/2540

I had to modify this since `useActiveElement` was always `<body>` in between `blur` and `focus`. That broke `useFocusWithin`. Made a pull request https://github.com/vueuse/vueuse/pull/2540

Since this is now merged and released in vueuse, maybe we can get rid of the code in here?

Since this is now merged and released in vueuse, maybe we can get rid of the code in here?
Author
Member

I think so, yes! Will check if it works :)

I think so, yes! Will check if it works :)
Author
Member

Oooops. Seems like I actually broke it instead :D
https://github.com/vueuse/vueuse/pull/2581

Oooops. Seems like I actually broke it instead :D https://github.com/vueuse/vueuse/pull/2581
Author
Member

Tried to fix it again with https://github.com/vueuse/vueuse/pull/2600.
But I guess it will take a bit until it's merged.
Let's not make this pull request dependant on the merge.

Tried to fix it again with https://github.com/vueuse/vueuse/pull/2600. But I guess it will take a bit until it's merged. Let's not make this pull request dependant on the merge.
Author
Member

Since it's merged now I'm adding the update.

Since it's merged now I'm adding the update.
dpschen marked this conversation as resolved
dpschen reviewed 2022-12-13 18:33:08 +00:00
@ -0,0 +132,4 @@
.expandable-slide-enter-active,
.expandable-slide-leave-active {
transition:
opacity $transition-time ease-in-quint,
Author
Member

These functions are possible with the postcss-easings plugin. There is somewhere a working draft for this (couldn't find, but I know it exists).

These functions are possible with the postcss-easings plugin. There is somewhere a working draft for this (couldn't find, but I know it exists).
dpschen marked this conversation as resolved
dpschen reviewed 2022-12-13 18:34:00 +00:00
@ -0,0 +154,4 @@
background-image: linear-gradient(
to bottom,
transparent,
ease-in-out
Author
Member

We use here easing gradients. Because it's visually the only thing that makes sense if you want to fade out content.

We use here [easing gradients](https://larsenwork.com/easing-gradients/). Because it's visually the only thing that makes sense if you want to fade out content.
dpschen marked this conversation as resolved
dpschen force-pushed feature/improve-add-task from 63f1074681 to 40367468e8 2022-12-13 18:37:53 +00:00 Compare
konrad reviewed 2022-12-18 18:47:33 +00:00
@ -0,0 +65,4 @@
const { display } = el.style // save display property
el.style.display = 'block' // Make it visible
const height = `${el.scrollHeight}px` // Get its height
// el.style.display = ''; // Hide it again

I think this comment can be removed.

I think this comment can be removed.
dpschen marked this conversation as resolved
@ -0,0 +117,4 @@
removeHeight(el)
}
function leaveCancelled(el: HTMLElement) {

Can you group all functions which just call removeHeight like this one? There's probably a good reason to define them with different names even though they all do the same, but it would be nice if they were grouped together so that it's all obvious in one place.

Can you group all functions which just call `removeHeight` like this one? There's probably a good reason to define them with different names even though they all do the same, but it would be nice if they were grouped together so that it's all obvious in one place.
Author
Member

I kept the orignal hook order of the vue transition component. Is it fine if I add some comments?

I kept the [orignal hook order of the vue transition component](https://vuejs.org/guide/built-ins/transition.html#javascript-hooks). Is it fine if I add some comments?

Yss, should be fine then.

Yss, should be fine then.
Author
Member

Todo: add comments

Todo: add comments
Author
Member

Done.

Done.
dpschen marked this conversation as resolved
@ -195,1 +214,3 @@
.task-add {
.task-add,
// overwrite bulma styles
.task-add .add-task__field {

If that's the whole purpose of the selector we might as well just us an mb-0 utility on the div instead.

If that's the whole purpose of the selector we might as well just us an `mb-0` utility on the div instead.
Author
Member

I would agree if we would add space here and not reset bulma styles.
But since we reset something that bulma did, where I'm not sure if that makes so much sence in the first place I would keep it here, so that if we remove this part of bulma we can easily remove the rules.

I would agree if we would _add_ space here and not reset bulma styles. But since we reset something that bulma did, where I'm not sure if that makes so much sence in the first place I would keep it here, so that if we remove this part of bulma we can easily remove the rules.
@ -1,5 +1,5 @@
<template>
<div v-if="available">
<div v-if="available && prefixes !== undefined">

Can't we move prefixes !== undefined to the available computed? Or better not?

Can't we move `prefixes !== undefined` to the `available` computed? Or better not?
Author
Member

I saw the available as isNotDisabled which is what is value is.
Will rename a bit and maybe add a third computed to make it clearer.

I saw the available as `isNotDisabled` which is what is value is. Will rename a bit and maybe add a third computed to make it clearer.
Author
Member

I removed the computed and put the calculation inline instead.

I removed the computed and put the calculation inline instead.
dpschen marked this conversation as resolved
dpschen force-pushed feature/improve-add-task from 40367468e8 to 3927965e26 2022-12-30 15:05:53 +00:00 Compare
Author
Member

@konrad can you check again?

@konrad can you check again?
dpschen changed title from feat: add-task usability improvements to WIP: feat: add-task usability improvements 2023-01-03 15:09:16 +00:00
dpschen force-pushed feature/improve-add-task from 3927965e26 to 634bdc8f02 2023-01-03 15:26:23 +00:00 Compare
dpschen changed title from WIP: feat: add-task usability improvements to feat: add-task usability improvements 2023-01-03 15:36:20 +00:00
konrad reviewed 2023-01-03 17:23:40 +00:00
@ -0,0 +132,4 @@
</script>
<style lang="scss" scoped>
$transition-time: 300ms;

Don't we already have a variable for this?

Don't we already have a variable for this?
Author
Member

There is the global $transition-duration but with 150ms it felt to short.

There is the global `$transition-duration` but with 150ms it felt to short.
konrad marked this conversation as resolved
@ -73,1 +79,4 @@
const taskAdd = ref<HTMLTextAreaElement | null>(null)
// enable only if we don't have a modal

What about this?

What about this?
Author
Member
See: https://kolaente.dev/vikunja/frontend/pulls/2767#issuecomment-41260
Owner

I think the current animation looks great and is a good middleground. There might be someone complaining afterwards but I think we'll just fix it in that case once it's merged and released.

I think the current animation looks great and is a good middleground. There might be someone complaining afterwards but I think we'll just fix it in that case once it's merged and released.
konrad approved these changes 2023-01-04 11:11:42 +00:00
konrad left a comment
Owner

Should be fine to merge once the CI passes.

Should be fine to merge once the CI passes.
konrad scheduled this pull request to auto merge when all checks succeed 2023-01-04 11:12:32 +00:00
Author
Member

I think the current animation looks great and is a good middleground. There might be someone complaining afterwards but I think we'll just fix it in that case once it's merged and released.

Sounds good! Was indeed more complex than anticipated.

> I think the current animation looks great and is a good middleground. There might be someone complaining afterwards but I think we'll just fix it in that case once it's merged and released. Sounds good! Was indeed more complex than anticipated.
Owner

Can you rebase again in main? Then the tests should pass.

Can you rebase again in main? Then the tests should pass.
dpschen force-pushed feature/improve-add-task from 634bdc8f02 to a0797570ed 2023-01-04 15:42:53 +00:00 Compare
konrad merged commit 4be53b098c into main 2023-01-04 15:54:10 +00:00
dpschen deleted branch feature/improve-add-task 2023-01-04 16:25:27 +00:00
This repo is archived. You cannot comment on pull requests.
No description provided.