Skip to content

Conversation

@marcustyphoon
Copy link
Collaborator

Description

Yikes.

This updates Collapsed Queue for the extra div that was added to the post DOM structure a few days ago. I thought I had tested this, but I misremembered; I tested Collapsed Queue with the new split-notes footer, but not the extra div.

Resolves #1933.

Testing steps

Confirm that Collapsed Queue works on both the draft and queue pages.

@marcustyphoon marcustyphoon added the bugfix Restores intended behavior label Oct 22, 2025
@marcustyphoon
Copy link
Collaborator Author

marcustyphoon commented Oct 22, 2025

Also doable declaratively, though it's sort of a pain to implement the same logic. ex:

    footerElement.before(
      div({ class: wrapperClass }, [
        div({ class: containerClass }, [
          ...footerElement.parentElement.querySelectorAll(
            `:scope > :not(:has(~ header), header, ${footerSelector}, ${footerSelector} ~ *)`
          )
        ])
      ])
    );
    const elements = [...footerElement.parentElement.children];

    const headerIndex = elements.findIndex(element => element.matches('header'));
    const footerIndex = elements.findIndex(element => element === footerElement);

    footerElement.before(
      div({ class: wrapperClass }, [
        div({ class: containerClass },
          elements.slice(
            headerIndex !== -1 ? headerIndex : 0,
            footerIndex !== -1 ? footerIndex : undefined
          )
        )
      ])
    );

Or one could still use a loop but run it on an array of elements, avoiding the multiple DOM manipulations.

@marcustyphoon marcustyphoon merged commit 4566bca into AprilSylph:master Oct 23, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Restores intended behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Collapsed Queue: use causes Firefox to become unresponsive

2 participants