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

Disable previous button (resolves #888) #1093

Merged
merged 3 commits into from
Aug 28, 2024
Merged

Conversation

Saira-A
Copy link
Contributor

@Saira-A Saira-A commented Aug 23, 2024

Description of what you did:

Disable previous button from being accessible via keyboard when on first page #888

Copy link

vercel bot commented Aug 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
universalviewer ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 28, 2024 11:26am

@Saira-A Saira-A marked this pull request as ready for review August 23, 2024 09:04
@Saira-A Saira-A changed the title Disable previous button Disable previous button #888 Aug 23, 2024
Copy link
Contributor

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Saira-A, if this solves a problem, should we also add parallel behavior to the disableNextButton/enableNextButton methods so everything is consistent?

@Saira-A
Copy link
Contributor Author

Saira-A commented Aug 23, 2024

@Saira-A, if this solves a problem, should we also add parallel behavior to the disableNextButton/enableNextButton methods so everything is consistent?

Like this? This causes another issue where the previous button becomes greyed out when on the last page. Otherwise it still has the runtime error that prevbutton had but it just loops back to the first page instead of going into negative numbers

disableNextButton(): void {
  this.nextButtonEnabled = false;
  this.$nextButton.disable();
  this.$prevButton.attr("disabled","disabled");
}

enableNextButton(): void {
  this.nextButtonEnabled = true;
  this.$nextButton.enable();
  this.$prevButton.removeAttr("disabled");
}

@demiankatz
Copy link
Contributor

@Saira-A, if this solves a problem, should we also add parallel behavior to the disableNextButton/enableNextButton methods so everything is consistent?

Like this? This causes another issue where the previous button becomes greyed out when on the last page. Otherwise it still has the runtime error that prevbutton had but it just loops back to the first page instead of going into negative numbers

disableNextButton(): void {
  this.nextButtonEnabled = false;
  this.$nextButton.disable();
  this.$prevButton.attr("disabled","disabled");
}

enableNextButton(): void {
  this.nextButtonEnabled = true;
  this.$nextButton.enable();
  this.$prevButton.removeAttr("disabled");
}

@Saira-A, I think you just need to change "$prevButton" to "$nextButton" in that code snippet, so that the next button is disabled instead of the prev button. :-)

@Saira-A
Copy link
Contributor Author

Saira-A commented Aug 23, 2024

@Saira-A, if this solves a problem, should we also add parallel behavior to the disableNextButton/enableNextButton methods so everything is consistent?

Like this? This causes another issue where the previous button becomes greyed out when on the last page. Otherwise it still has the runtime error that prevbutton had but it just loops back to the first page instead of going into negative numbers

disableNextButton(): void {
  this.nextButtonEnabled = false;
  this.$nextButton.disable();
  this.$prevButton.attr("disabled","disabled");
}

enableNextButton(): void {
  this.nextButtonEnabled = true;
  this.$nextButton.enable();
  this.$prevButton.removeAttr("disabled");
}

@Saira-A, I think you just need to change "$prevButton" to "$nextButton" in that code snippet, so that the next button is disabled instead of the prev button. :-)

Oops, that would explain it! fixed

Copy link
Contributor

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @Saira-A! This makes sense to me if @LanieOkorodudu can't find any problems. :-)

@LanieOkorodudu
Copy link
Collaborator

Thanks, @Saira-A! This makes sense to me if @LanieOkorodudu can't find any problems. :-)

I think the prev button still not working using the keyboard..

Copy link
Contributor

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I see what @LanieOkorodudu is talking about. I think the prev/next buttons are working now, but there are also first/last buttons that need the same treatment in their functions (just above the ones that have already been adjusted). I think that should fully solve the problem.

@Saira-A
Copy link
Contributor Author

Saira-A commented Aug 28, 2024

I think the prev button still not working using the keyboard..

It only works if you click the button first and then use the enter key, it doesn't use the left/right arrow keys if that's what you mean @LanieOkorodudu

I added the same to the first/last buttons, thanks @demiankatz

@LanieOkorodudu
Copy link
Collaborator

I think the prev button still not working using the keyboard..

It only works if you click the button first and then use the enter key, it doesn't use the left/right arrow keys if that's what you mean @LanieOkorodudu

I added the same to the first/last buttons, thanks @demiankatz

@Saira-A Yes that's what I mean but probably that's different issue to address. I just check it in vercel app and it's working now. Just as you said you have to initiate the click first then press enter key. This should address and solve the issue #888. Thanks again @Saira-A and @demiankatz

Copy link
Contributor

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @Saira-A and @LanieOkorodudu!

@demiankatz demiankatz changed the title Disable previous button #888 Disable previous button (resolves #888) Aug 28, 2024
@demiankatz demiankatz merged commit 644e838 into UniversalViewer:dev Aug 28, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants