Problem/Motivation

  • Pagination click scrolls the page to the top
  • Pagination results scroll

Steps to reproduce
  • Go to /admin/modules/browse
  • Click on the pagination displayed at the bottom of the page
  • It will show the results and take you to the top of the page

Proposed resolution

After the pagination results it should keep the focus on the Project Browser component itself or focus on the first row of the results and the page should scroll to the results tabs instead of the page top.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Prashant.c created an issue. See original summary.

sourav_paul’s picture

Assigned: Unassigned » sourav_paul

prashant.c’s picture

Thanks for raising the PR.

In case you are still working on this then keep it assigned to yourself otherwise you can unassign and move the issue to the Needs Review state.

sourav_paul’s picture

Version: 1.0.x-dev » 1.0.0-beta5
Assigned: sourav_paul » Unassigned
Status: Active » Needs review

I've fixed the code.
Maintainers pls review it.

Sourav_Paul changed the visibility of the branch 3452431-pagination-click-should to hidden.

Sourav_Paul changed the visibility of the branch 3452431-pagination-click-should-1.0.0beta5 to hidden.

Sourav_Paul changed the visibility of the branch 3452431-pagination-click-should-1.0.0beta@5 to hidden.

sourav_paul’s picture

Status: Needs review » Needs work

I've solved the issue, but can't able to build the JS file as it requires node version greater than 16, whereas in Linux latest node version isn't available,

Hence if anyone could build the JS,
Pls update the MR.

Thanks In advance...

prashant.c’s picture

Status: Needs work » Needs review

I tried to compile the files using yarn install and yarn build , these are compiling.
Needs to be reviewed.

@Sourav_Paul Looks like NPM won't work for this only yarn will work. You can go through this README file https://git.drupalcode.org/project/project_browser/-/blob/1.0.x/README.m... which is part of this module itself.

kanchan bhogade’s picture

Status: Needs review » Needs work

I was able to reproduce the issue, But MR !494 is falling and in summary, also in Issue summary MR is an "Open failed Pipeline"

Updating issue status to "Needs work"

gauravvvv’s picture

StatusFileSize
new266.7 KB

On the MR !494, we have hardcoded href={'#drupalorg_mockapi'} which breaks when we're on the recipes tab. It takes the focus to the id=drupalorg_mockapi" tab, which should be on the current tab.

gauravvvv’s picture

Status: Needs work » Needs review
dishakatariya’s picture

StatusFileSize
new966.55 KB

I have tried to reproduce this issue but still i am getting the same results.
Attaching recordings.
Test Results are:
Click on the pagination displayed at the bottom of the page
It will show the results and take you to the top of the page

dishakatariya’s picture

Status: Needs review » Needs work
chrisfromredfin’s picture

Please re-check this on latest 2.0.x. I think I was able to see the behavior only the very first time I loaded it after an install, but then never again.

Also, I think paging for Recipes is completely broken, actually - we may not be storing pager settings correctly, or not resetting them when switching tabs (for example I can switch from one source to the other and the pager still thinks I'm on page 3 - and changing pages doesn't change which recipes it's showing me).

Can we get some additional testing on the 2.0.x and an update of this issue summary with the needed fixes?

chrisfromredfin’s picture

Title: Pagination click should keep the focus on Project browser component » Pagination doesn't work except on the first plugin

OK, after some more digging it seems the pager just flat-out doesn't work correctly for anything except the first tab that's enabled. Depending on how you order it, that one will work. So by default, paging doesn't work on the recipes plugin. But, if you make Recipes the first in the order, it will work (and then won't work for plugins 2 or 3).

omkar-pd made their first commit to this issue’s fork.

omkar-pd’s picture

Version: 1.0.0-beta5 » 2.0.x-dev

omkar-pd changed the visibility of the branch 3452431-pagination-click-should-1-0-0beta5 to hidden.

omkar-pd’s picture

Tested with the latest 2.0.x and can reproduce the issue from #17.

In EnabledSourceHandler.php this code overwrite the page parameters in $query.

      if ($displayed_source && $displayed_source !== $source_name) {
        // If the source is not the one currently displayed in the UI, request
        // page 0.
        $query['page'] = 0;
        $query['categories'] = implode(", ", $tabwise_categories[$source_name] ?? []);
      }

Pushed a fix.

chrisfromredfin’s picture

Status: Needs work » Reviewed & tested by the community

Manually tested and reviewed code. Works! Waiting to ship this until #3464077: Remove or demote mock to test folder goes in.

chrisfromredfin’s picture

chrisfromredfin’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for this work!

sourav_paul’s picture

Awesome..

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.