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

@page :first isn't working as expected in paged.js #733

Open
1 task done
geealbers opened this issue May 17, 2023 · 5 comments
Open
1 task done

@page :first isn't working as expected in paged.js #733

geealbers opened this issue May 17, 2023 · 5 comments
Assignees
Labels
bug Actual behavior does not match expected behavior output:pdf An issue with the pdf output status:backlog Issue is a lower priority but needs to eventually be addressed

Comments

@geealbers
Copy link
Member

Before proceeding, check to make sure there isn’t an existing issue for this bug.

  • I have searched the existing issues and determined this is a new bug.

Steps to reproduce

  1. Start a new project
  2. Run quire build and quire pdf to generate the PDF

Actual behavior

The chapter title is being included on the first page of the main essay, which is page number 1, even though we've set a :first page rule to remove it:

@page:right:first {
    @bottom-left {
      content: none;
    }
  }

The :first rule only seems to be working on named pages, though the paged.js documentation seems to indicate it should work on all pages. In Prince, we had to define prince-page-group: start; on .quire-page to get :first to work properly. Is there something similar with paged.js?

pagedjs_Page_11

Expected behavior

The bottom-left margin area should be blank on page 1.

Version numbers

Quire CLI 1.0.0-rc.7
Quire 11ty 1.0.0-rc.9
Node 18.16.0

What browsers are you seeing the problem on?

No response

Relevant Terminal/Shell output

No response

Supporting Information

No response

@geealbers geealbers added the status:triage needed Issue needs to be triaged by the Quire team. This label is automatically applied to new issues. label May 17, 2023
@fchasen
Copy link
Collaborator

fchasen commented May 26, 2023

I'm seeing a syntax error for using both page selectors like :right:first - unsure if that just pagedjs not parsing it correctly of if it's invalid. Seems like https://www.w3.org/TR/css-page-3/#syntax-page-selector says only one can be used?

For the case above using the page name + :first works ok, but is the intention this should only happen if it a right page?

  @page page-one:first {
    @bottom-left {
      content: none;
    }
  }

It isn't pretty but you could get this to work by using the pagedjs classes directly:

.pagedjs_page.pagedjs_right_page[class$='_first_page'] .pagedjs_margin-bottom-left > .pagedjs_margin-content::after {
    content: none;
}

@geealbers
Copy link
Member Author

@fchasen, yes, the goal is to be able to remove the bottom-left content if it's a first right-hand page, because that content is the page title and so duplicative of the main heading on the page.

From what I'm seeing, the spec shows a couple examples with two pseudo pages in a selector like @page :blank:first { ... }, so I would assume @page :right:first { ... } would also work, no? I'm also not able to get just @page :first { ... } to do anything in paged.js. It seems to need to be @page page-name:first { ... }. Are you seeing that as well?

@Erin-Cecele Erin-Cecele added status:in progress Issue is under development output:pdf An issue with the pdf output bug Actual behavior does not match expected behavior and removed status:triage needed Issue needs to be triaged by the Quire team. This label is automatically applied to new issues. labels May 30, 2023
@fchasen
Copy link
Collaborator

fchasen commented May 31, 2023

Ah thanks, I missed that one - working on an update to support multiple selectors.

I'm still not sure :right:first works for this though, my impression was that :first (without a name) only refers to the very first page in the document?

@geealbers
Copy link
Member Author

Ok, so to enable the targeting of a first page of any chapter in the book, I think I need to look at refactoring the css so that every chapter is a named page, so that I can apply @page page-name :right:first { ... } to it.

Prince has the idea of Page Groups (https://www.princexml.com/doc/paged/#page-groups) where it lets you apply -prince-page-group: start to an element to indicate that it is the start of a new page group, and so honors the :first pseudo element without having named pages.

@geealbers geealbers assigned geealbers and unassigned fchasen Jun 5, 2023
@Erin-Cecele
Copy link
Collaborator

We are currently working on a fix for your bug! Stay tuned for updates, and thank you for your important contribution.

@Erin-Cecele Erin-Cecele added status:backlog Issue is a lower priority but needs to eventually be addressed and removed status:in progress Issue is under development labels Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Actual behavior does not match expected behavior output:pdf An issue with the pdf output status:backlog Issue is a lower priority but needs to eventually be addressed
Projects
None yet
Development

No branches or pull requests

3 participants