daily-code icon indicating copy to clipboard operation
daily-code copied to clipboard

fix: Clickable Disabled Navigation Buttons in TrackTools Component

Open Amit-K-007 opened this issue 1 year ago • 0 comments

Description:

This PR addresses the issue where the "Prev" and "Next" buttons in the TrackTools component remain clickable even when disabled, resulting in unnecessary re-renders. This was happening because the Link component was still clickable even if the button inside it is disabled.

Changes Made:

  • Prev Button:

    • If problemIndex is 0, the pointer-events on the Link are disabled.
    • The Link is wrapped in a div that has a cursor: not-allowed style if problemIndex is 0 (indicating the First Slide).
  • Next Button:

    • If problemIndex + 1 equals the length of track.problems, the pointer-events on the Link are also disabled.
    • The Link is wrapped in a div that applies the cursor: not-allowed style if problemIndex + 1 equals the length of track.problems (indicating the Last Slide).

Demo

https://github.com/user-attachments/assets/3cfb7cca-7cde-4d59-a55a-73aa1cf5dca6

Resolves: #667

Amit-K-007 avatar Sep 28 '24 19:09 Amit-K-007