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

[1.2.0 RC2] Autofocus and cursor pointer #827

Closed
Dennis1993 opened this issue Feb 15, 2020 · 10 comments · Fixed by #846
Closed

[1.2.0 RC2] Autofocus and cursor pointer #827

Dennis1993 opened this issue Feb 15, 2020 · 10 comments · Fixed by #846

Comments

@Dennis1993
Copy link

I tested the new 1.2.0 RC2. It is very good. But I have twi minimal enhancements.

  1. If I create a public link to share the plus icon is not a pointer cursor:
    image

  2. If I visit the shared link the autofocus is not on the username textarea:
    image

@Dennis1993 Dennis1993 changed the title [1.2.0 RC2] Autofocus and cursoir pointer [1.2.0 RC2] Autofocus and cursor pointer Feb 15, 2020
@dartcafe
Copy link
Collaborator

resolved in 1.3

@dartcafe
Copy link
Collaborator

Em. I think I dreamt about that. Still open.

@dartcafe dartcafe reopened this Feb 16, 2020
@dartcafe dartcafe added the bug label Feb 16, 2020
@dartcafe
Copy link
Collaborator

I changed the link for creating a public share to a button. Fits better to an action like this IMHO.

@dartcafe
Copy link
Collaborator

dartcafe commented Feb 18, 2020

I tried different approches, but I can't get the focus on this input field. Anyone who has a solution?

@v1r0x
Copy link
Collaborator

v1r0x commented Feb 18, 2020

I can have a look at this tomorrow

@dartcafe
Copy link
Collaborator

It should work here:

mounted() {
this.setFocus()
},
methods: {
setFocus() {
this.$nextTick(() => {
this.$refs.userName.focus()
})
},

But I get a JS error:

Vue warn]: Error in nextTick: "TypeError: _this.$refs.userName is undefined"

found in

---> <VoteHeaderPublic> at src/js/components/VoteTable/VoteHeaderPublic.vue

Calling $vm0.$refs.userName.focus() in the js console works then (VoteHeaderPublic as $vm0).

I also tried to do this via a directive, but I get the same error.

I guess, the modal component rendering is not ready, when calling from mounted(). Maybe @skjnldsv can explain, if you find no way.

@v1r0x
Copy link
Collaborator

v1r0x commented Feb 19, 2020

Problem is the v-if together with vuex (if I read this correctly in different issues). I fixed it by adding a watcher to the v-if condition (poll.id) and then calling this.setFocus() instead of in mounted().

watch: {
	userName: function() {
            ...
	},
        'poll.id': function(newValue) {
            this.setFocus()
        }
},

mounted() {
    // removed this.setFocus()
},

@dartcafe Do you already have a branch or something for this issue or should I fix it?

@dartcafe
Copy link
Collaborator

https://github.com/nextcloud/polls/tree/publicLinkCursor adresses the other issue (pointer cursor). I also added a custom button component there.

@dartcafe
Copy link
Collaborator

Problem is the v-if together with vuex

Ah, yes. I had some also, so I used v-show in some places because of that.

@dartcafe
Copy link
Collaborator

@v1r0x I wanted to test your solution and already applied it to the branch. Works perfectly 👍 Didn't want to rush things, but I was curious.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants