Skip to content

Disable previous button (resolves #888)#1093

Merged
demiankatz merged 3 commits into
UniversalViewer:devfrom
Saira-A:888
Aug 28, 2024
Merged

Disable previous button (resolves #888)#1093
demiankatz merged 3 commits into
UniversalViewer:devfrom
Saira-A:888

Conversation

@Saira-A

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

Copy link
Copy Markdown
Contributor

Description of what you did:

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

@vercel

vercel Bot commented Aug 23, 2024

Copy link
Copy Markdown

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

@demiankatz demiankatz left a comment

Copy link
Copy Markdown
Contributor

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

Saira-A commented Aug 23, 2024

Copy link
Copy Markdown
Contributor Author

@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
Copy Markdown
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

Saira-A commented Aug 23, 2024

Copy link
Copy Markdown
Contributor Author

@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

@demiankatz demiankatz left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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..

@demiankatz demiankatz left a comment

Copy link
Copy Markdown
Contributor

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

Saira-A commented Aug 28, 2024

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
Contributor

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

@demiankatz demiankatz left a comment

Copy link
Copy Markdown
Contributor

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
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