So I was prompted today to look at the navigation of the book module, more specifically the Previous, Up and Next links. At the moment they are just hanging out on their own without a great deal of structure, so I decided to add some structure to give them a bit more meaning.

Essentially this is a list of 2 or 3 items so it should be treated that way. Because it's a list, it should have a header to define why the list is there. And then finally for screen readers there should be a description of Previous, Up and Next appended after the title of the links.

I've included this sample as an example.

CommentFileSizeAuthor
#131 book-cleanup4.patch8.92 KBmortendk
#128 book-cleanup3.patch8.92 KBmortendk
#125 book-cleaner2.patch8.94 KBmortendk
#124 book-cleaner.patch8.96 KBmortendk
#122 up navigation bartik.jpg50.65 KBmortendk
#122 up navigation.jpg95.21 KBmortendk
#122 book-uparrow.patch9.39 KBmortendk
#121 book-2.patch9.21 KBmortendk
#121 borderless & vertical alignment.jpg64.14 KBmortendk
#118 book.patch9.39 KBmortendk
#117 book-736604-117.patch8.78 KBjyve
#113 up.jpg42.38 KBdroplet
#109 book-736604-109.patch8.82 KBjyve
#103 book-documentationfix.patch8.87 KBmortendk
#100 book-centerfix2.patch8.83 KBmortendk
#99 modern browsers-1.jpg124.04 KBmortendk
#99 ie7.jpg52.03 KBmortendk
#99 ie8.jpg44.33 KBmortendk
#99 book-centerfix.patch8.83 KBmortendk
#98 width.png78.35 KBdroplet
#97 book-navigation.patch8.93 KBmortendk
#97 chrome 3.jpg42.36 KBmortendk
#97 chrome 2.jpg18.58 KBmortendk
#97 chrome 1.jpg16.22 KBmortendk
#97 opera 3.jpg45.85 KBmortendk
#97 opera 2.jpg22.46 KBmortendk
#97 opera 1.jpg20.78 KBmortendk
#97 firefox 3.jpg43.73 KBmortendk
#97 firefox 2.jpg23.04 KBmortendk
#97 firefox 1.jpg30.48 KBmortendk
#97 ie9 3.jpg43.43 KBmortendk
#97 ie9 2.jpg20.65 KBmortendk
#97 ie9 1.jpg51.58 KBmortendk
#97 ie8 3.jpg41.23 KBmortendk
#97 ie8 2.jpg22.24 KBmortendk
#97 ie8 1.jpg28.63 KBmortendk
#97 ie7 rtl 2.jpg44.7 KBmortendk
#97 ie7 rtl 1.jpg66.99 KBmortendk
#97 ie7 3.jpg22.59 KBmortendk
#97 ie7 2.jpg20.93 KBmortendk
#97 ie7 1.jpg27.46 KBmortendk
#97 ie7 stark 3.jpg44.75 KBmortendk
#97 ie7 stark 2.jpg24.36 KBmortendk
#97 ie7 stark 1 .jpg30.34 KBmortendk
#94 book-clean-up.patch8.25 KBdroplet
#91 book-dieclearfix-rtl2.patch8.85 KBmortendk
#88 book-dieclearfix-rtl.patch9.07 KBmortendk
#86 book-dieclearfixdie.patch8.95 KBmortendk
#86 ie7 2.jpg20.93 KBmortendk
#86 ie7 stark 2.jpg24.36 KBmortendk
#86 ie8 2.jpg22.24 KBmortendk
#86 ie7 rtl 2.jpg44.7 KBmortendk
#85 book-accessibility-css-2.patch8.12 KBmortendk
#83 book-accessibility-css-2.patch8.31 KBmortendk
#80 book-accessibility-css.patch8.1 KBmortendk
#76 booknavigation_v2.patch3.49 KBtjhellmann
#72 booknavigation.patch1.79 KBtjhellmann
#58 736604-book-nav.png25.72 KBsvendecabooter
#57 book-accessibility-736604-57.patch4.46 KBsvendecabooter
#56 book-accessibility-736604-55.patch4.57 KBmgifford
#54 book-accessibility-736604-54.patch2.62 KBmgifford
#47 book-accessibility-736604-47.patch4.46 KBmgifford
#48 book-accessibility-736604-48.patch4.61 KBmgifford
#48 seven-book.png21.92 KBmgifford
#48 stark-book.png28.59 KBmgifford
#48 garland-book.png25.66 KBmgifford
#48 bartik-book.png26.65 KBmgifford
#41 book_accessibility_v10.patch3.8 KBmgifford
#34 book_accessibility_v9.patch3.8 KBmgifford
#32 book_accessibility_v8.patch4.21 KBmgifford
#24 book_accessibility_v7.patch2.65 KBmgifford
#23 book_accessibility_v6.patch2.52 KBmgifford
#18 book_accessibility_v5.patch2.44 KBmgifford
#18 screen-capture-1.png136.25 KBmgifford
#14 book_accessibility_v4.patch2.23 KBmgifford
#14 screen-capture.png142.21 KBmgifford
#7 book_accessibility_v3.patch2.4 KBmgifford
#4 screen-capture-6.png35.07 KBmgifford
#1 book_accessibility_v2.patch2.35 KBmgifford
book_accessibility_v1.patch2.36 KBmgifford
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mgifford’s picture

FileSize
2.35 KB

Just noticed I need to change the text on the 2nd & 3rd pieces of appended text. It's also worth noting that CSS & I still don't get along. The list items should be hidden, but seem to be floating around.

mgifford’s picture

This is a simple patch that adds semantic data to a piece of Drupal core. Just needs better CSS to ensure that the layout doesn't change.

mgifford’s picture

This is a simple patch that adds semantic data to a piece of Drupal core. Just needs better CSS to ensure that the layout doesn't change.

mgifford’s picture

FileSize
35.07 KB

Just added an example here:

http://drupal7.dev.openconcept.ca/node/3

Along with an ugly screen shot. It's semantically much better though.

      <h2 class="element-invisible">Book Navigation</h2>

      <ul class="book-navigation-list">
              <li><a href="/node/4" class="page-previous" title="Go to previous page">‹ 3 - the last<span class="element-invisible">(Go to previous page)</span></a>
                    <li class="book-navigation-list"><a href="/node/1" class="page-up" title="Go to parent page">up<span class="element-invisible">(Go to parent page)</span></a>
                  </ul>
    </div>
mgifford’s picture

Status: Active » Needs review

How did I never set this as needs review anyways?

Status: Needs review » Needs work

The last submitted patch, book_accessibility_v2.patch, failed testing.

mgifford’s picture

Status: Needs work » Needs review
FileSize
2.4 KB

It's still ugly css

Status: Needs review » Needs work

The last submitted patch, book_accessibility_v3.patch, failed testing.

Everett Zufelt’s picture

Priority: Normal » Major

Thanks for rolling this patch. I was just noticing this problem this week and didn't remember if we had an open issue.

IMO this is actually critical, the links in head right now make little to no sense since there is no context. That being said functionality isn't broken, but ux is severely diminished.

Everett Zufelt’s picture

Title: Book Module Navigation Needs Work » Book Module Navigation links need better context for accessibility
Everett Zufelt’s picture

Issue tags: +Simpletest

Looks like the book module simpletests just need to be updated.

mgifford’s picture

This needs CSS changes too. It's a list, but the positioning needs to be modified to look like the current verison (or perhaps improve it).

Everett Zufelt’s picture

This is a WCAG A issue:

2.4.4 Link Purpose (In Context): The purpose of each link can be determined from the link text alone or from the link text together with its programmatically determined link context,except where the purpose of the link would be ambiguous to users in general.(Level A)

http://www.w3.org/TR/UNDERSTANDING-WCAG20/navigation-mechanisms-refs.html

mgifford’s picture

Status: Needs work » Needs review
FileSize
142.21 KB
2.23 KB

Ok, this patch addresses the CSS issues. Hopefully the simpletests aren't still a problem.

Oh yes, the screen-shots provide a view of the page with Firebug open showing that it is indeed using proper lists rather than divs.

Status: Needs review » Needs work
Issue tags: -Accessibility, -Simpletest

The last submitted patch, book_accessibility_v4.patch, failed testing.

mgifford’s picture

Status: Needs work » Needs review
Issue tags: +Accessibility, +Simpletest

#14: book_accessibility_v4.patch queued for re-testing.

Everett Zufelt’s picture

Status: Needs review » Needs work

The title attributes on the anchors will not be available to most screen-reader users, and some screen-readers (e.g. JAWS) will not read the characters in the link text like ‹ . Can we somehow add this information to the anchor text?

Also, when using characters like ‹ we should be using html entities like &raquo;

mgifford’s picture

Status: Needs work » Needs review
FileSize
136.25 KB
2.44 KB

Ok. This is becoming more of an upgrade, but certainly improves accessibility more.

It's up here now: http://drupal7.dev.openconcept.ca/node/5

I've attached a screenshot with firebug opened.

I've cleaned up the formatting of the links so that it isn't such a huge long line.

I've moved the title text over to properly hidden text.

I've also changed the < > characters to the appropriate HTML entities. Thanks for the review.

Now we need another one.

mgifford’s picture

Issue tags: -Simpletest

nixing simpletest. doesn't seem to be a problem any longer.

Everett Zufelt’s picture

Thanks, looking good. Final comments.

1. These links should be proceeded by a heading like the pagination links on the default front page.
2. Do we need to get rid of the title attribute, or should we be doing title + invisible span?
3. I'm thinking the text in the invisible span is a bit verbose.

Status: Needs review » Needs work
Issue tags: -Accessibility

The last submitted patch, book_accessibility_v5.patch, failed testing.

mgifford’s picture

Status: Needs work » Needs review
Issue tags: +Accessibility

#18: book_accessibility_v5.patch queued for re-testing.

mgifford’s picture

FileSize
2.52 KB

> 1. These links should be proceeded by a heading like the pagination links on the default front page.

Good point. I've added this.

> 2. Do we need to get rid of the title attribute, or should we be doing title + invisible span?

Title would give us the tool tips.. Invisible span gives us accessibility. I'm thinking we'll have to add back in the tooltips but we'll see.

> 3. I'm thinking the text in the invisible span is a bit verbose.

At this stage the more different it is the harder it will be to get in. This is especially true for anything that needs to be translated. The text can be perfected for D8. This is already much better than it was.

mgifford’s picture

FileSize
2.65 KB

This patch includes the title so that it has the tool tips for sighted users.

Status: Needs review » Needs work
Issue tags: -Accessibility

The last submitted patch, book_accessibility_v7.patch, failed testing.

mgifford’s picture

Status: Needs work » Needs review

#24: book_accessibility_v7.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +Accessibility

The last submitted patch, book_accessibility_v7.patch, failed testing.

sun.core’s picture

Category: bug » task
Priority: Major » Normal

Good catch. However, while worth to fix, this bug is not really major.

mgifford’s picture

I do really need some help to work through the simpletests here. I thought I'd been able to resolve it, but unfortunately it still fails.

mgifford’s picture

Status: Needs work » Needs review
Issue tags: -Accessibility

#24: book_accessibility_v7.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +Accessibility

The last submitted patch, book_accessibility_v7.patch, failed testing.

mgifford’s picture

Status: Needs work » Needs review
FileSize
4.21 KB

I really don't know why this patch fails. I've wasted several hours today looking at it thinking maybe if I just slightly tweak one of these three lines of code I'll be able to get it passed the bot. I really doubt it.

It's frustrating how difficult it is to debug assertions. I really have no way to get a verbose output of what it's doing the comparison against!

Status: Needs review » Needs work

The last submitted patch, book_accessibility_v8.patch, failed testing.

mgifford’s picture

Status: Needs work » Needs review
FileSize
3.8 KB

Ok, I believe in SimpleTest. I know it's needed. But it shouldn't be this painful. Yikes. If this works I might have some ideas to help others avoid this grief I've been having about it.

Anyways, had some great help on IRC earlier today (well yesterday actually). Spaces definitely matter. HTML entities are not converted to anything and are as they are written in the code. And remember that you have to change the default for the l() to accept HTML....

Ok, now with any luck, this will be approved by the bot when I wake up.

mgifford’s picture

Oh ya, the HTML isn't as pretty as it was before in the template. But one big long string is way easier to deal with than figuring out if I need to insert " \n " all over the place.

Status: Needs review » Needs work

The last submitted patch, book_accessibility_v9.patch, failed testing.

Everett Zufelt’s picture

Issue tags: +markup

Tagging with markup to make sure that the changes are acceptable to the markup maintainers.

mgifford’s picture

Status: Needs work » Needs review

#34: book_accessibility_v9.patch queued for re-testing.

mgifford’s picture

I can't for the life of me understand how function testJail() could legitimately fail due to the book module, so I'm retesting it. "The test did not complete due to a fatal error. Completion check filetransfer.test 67 FileTranferTest->testJail()"

I'm assuming it's just a temporary bug that's going to hit a bunch of tests & be fixed quickly.

pfrenssen’s picture

Some minor comments:

  • book.css should have 2 spaces preceding the line 'list-style: none;' and adds an unneeded empty line at the bottom.
  • book.test has the number 2 in the string "Previous page link found2." Is this part of your magic to pass the test bot?

For the rest the patch looks fine, it makes the HTML of the book navigation semantically meaningful.

mgifford’s picture

Issue tags: +semantics
FileSize
3.8 KB

Thanks for the review @pfressen - I've applied these changes and tested it against the latest release and it all works fine.

Hopefully we can get this into core for a more accessible & semantic improvement. I really don't see a downside to including this change in a point release.

pfrenssen’s picture

Status: Needs review » Reviewed & tested by the community

Looks fine to me now.

dawehner’s picture

Version: 7.x-dev » 8.x-dev
Issue tags: +Needs backport to D7
Dries’s picture

Tried applying this patch but got:

deimos:drupal-head dries$ git apply < ../f.p 
error: No changes

Patch might be in the wrong format?

Dries’s picture

Tried applying this patch but got:

deimos:drupal-head dries$ git apply < ../f.p 
error: No changes

Patch might be in the wrong format?

Jeff Burnz’s picture

I'm not going to touch the status right now but with regards to workflow etc this will need some CSS for Bartik, maybe even D8 core(?), looking at the screenshot in #6 we can see this borks out Garland so no way we can backport without CSS fixes for both themes in D7 (Bartik & Garland) - either we do that here or in new issues, and possible block a point release until such time that CSS is ready?

mgifford’s picture

Status: Needs review » Needs work
FileSize
4.46 KB

Ok, I gitafied the last patch. It wasn't properly created it seems.

I got a few whitespace errors, but not sure how relevant that is:
warning: squelched 6 whitespace errors
warning: 11 lines add whitespace errors.

There are also still definitely CSS errors in Bartik http://drupal8.dev.openconcept.ca/node/51

I'm dropping this down to needs work.

EDIT: That link is now fixed up so feel free to check it out.

mgifford’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
26.65 KB
25.66 KB
28.59 KB
21.92 KB
4.61 KB

Ok, here's with the fixed CSS and screenshots (including garland)

mgifford’s picture

Status: Needs work » Needs review

#48: book-accessibility-736604-48.patch queued for re-testing.

Jeff Burnz’s picture

Status: Needs review » Needs work

There are some white space issues in this patch.

Wondering if the titles are too verbose - things like "Go to previous page", could that be better said as just "Previous page", thinking about how screen readers will synthesize this, something along the lines of:

link, [link-title], Previous page

To me that makes grammatical sense, however this reads/sounds a little odd:

link, [link-title], Go to previous page

Any strong reason for removing the wrapper? In HTML5 we could use a nav or footer wrapper for these.

Everett Zufelt’s picture

+1 for 'Previous page' It's a link, I can infer that I am going somewhere :)

mgifford’s picture

Annoying with the white spaces, should be easy to clean up though.

For consistency I just used the language in the title so that it would be expressed to the screen reader but provide no additional work for translation (seeing as it is the exact same string). As in other patches I've assumed that if it's good enough in a title attribute for sighted users, it's good enough for screen readers. I think both could be simplified.

I can also put back in the wrapper. No problem there, I think I was trying to simplify things. Should I use footer or nav in this d8 patch?

Both the text & the navigation would probably need to be different in a backport for D7.

Jeff Burnz’s picture

I think just leave the wrapper and go for the main issue - the accessibility improvement, we have an issue open for HTML5ifying this template: #1189828: Convert book-navigation.tpl.php to HTML5

mgifford’s picture

Status: Needs work » Needs review
FileSize
2.62 KB

Ok, I added the div back, re-ordered all the spacing, removed the unwanted spacing and changed the text in both the title & invisible text. When it's in 8 I'll work on creating a backported version for D7 & can add the HTML5 version by switching the div to a nav or footer.

Status: Needs review » Needs work

The last submitted patch, book-accessibility-736604-54.patch, failed testing.

mgifford’s picture

Status: Needs work » Needs review
FileSize
4.57 KB

I thought I'd uploaded this one with modified tests. I forgot that when I uploaded it initially.

svendecabooter’s picture

Here is an updated patch that removes the whitespaces errors upon applying it.

svendecabooter’s picture

Status: Needs review » Needs work
FileSize
25.72 KB

This is indeed an improvement over the current markup.
However i noticed there is still a layout problem where the book navigation borders are shown twice. (see attached screenshot)
I tested this in both Bartik & Seven.

This is caused by the fact that both the div and the ul in book-navigation.tpl.php have the CSS class page-links.
I'm sure that's not the intended behaviour?

Everett Zufelt’s picture

Component: book.module » markup
mgifford’s picture

Component: markup » book.module

The goal is to have it act/behave just like it does now, but with proper mark up.

Can you roll up a patch that resolves that problem? Thanks for posting the screenshot!

mgifford’s picture

Component: book.module » markup

Just changing the component as Everett & I seem to be working on this at the same time.

Everett Zufelt’s picture

Just to clarify, I am not currently working on this issue, just moving it to the correct component.

This is certainly part of Book.module, but it is a Markup issue. In order for Markup / CSS / JS folk to find issues easily we are moving issues into most appropriate component.

Sometimes it's a bit unclear about where something should go, but the core issue here is about markup, not about how Book behaves.

mortendk’s picture

hey
just wanna inform you that were working on cleaning up the css & follow the BAT rules for the filenaming over here : http://drupal.org/node/1216970
so we should keep an eye out for eachother so we dont end up crashing ;)

mgifford’s picture

Status: Needs work » Needs review
Issue tags: -Accessibility, -markup, -semantics, -Needs backport to D7

#57: book-accessibility-736604-57.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +Accessibility, +markup, +semantics, +Needs backport to D7

The last submitted patch, book-accessibility-736604-57.patch, failed testing.

mgifford’s picture

Ok, this patch needs to be re-rolled, keeping in mind #1216970: Clean up the CSS for Book module

Jacine’s picture

Issue tags: -Needs backport to D7 +html5

I marked this #1189828: Convert book-navigation.tpl.php to HTML5 a duplicate of this issue. There's no point in looking at this twice, as we ultimately want the same results here.

mgifford’s picture

Status: Needs work » Closed (duplicate)

That works for D8, but it means abandoning the effort to do this right in D7 with HTML4. Not that there's been a lot of momentum on the thread, just wanted to clearly state this here.

We can always re-open this thread if that changes.

Jacine’s picture

Status: Closed (duplicate) » Needs work

We can definitely work here... There's more done here anyway. The other issue had no patch, so I closed it.

As far as D7 goes, @webchick will never allow this to be backported. Sorry about that! I should have stated that when I removed the tag.

Jacine’s picture

Actually, I will ask @webchick to chime in on that rather than speaking for her. I am just 99.9% sure it's a no-go for D7 based on previous experience. ;)

mgifford’s picture

Thanks @Jacine!

tjhellmann’s picture

Status: Needs work » Needs review
FileSize
1.79 KB

Here's a go at it. It's my first patch, so if there are errors, I apologize. Working from the previous patch, I replaced the wrapper div with a more semantic nav element and added the rel=”next” and rel=”prev” links to the first and last (http://dev.w3.org/html5/spec/links.html#sequential-link-types). Seems that rel="up" has been deprecated in the HTML5 spec. I didn't add any CSS changes as Jacine asked me just to stab at the markup first.

Status: Needs review » Needs work

The last submitted patch, booknavigation.patch, failed testing.

mgifford’s picture

@tjhellmann - congrats on your first patch. Appreciate the explanation about your changes too.

I haven't looked into why the bot didn't like it, but noticed that you didn't adjust the CSS & test files. #57 is a good example for those.

Great to see this being upgraded to HTML5!

webchick’s picture

/me hires Jacine as official spokesperson!

That's correct. .tpl.php files are locked down for D7, and have been since the end of polish phase in December 2010.

tjhellmann’s picture

Status: Needs work » Needs review
FileSize
3.49 KB

Here is another take at it. Added the clearfix class back on the ul in the markup – I was thinking it would be ideal to do without it, but the current CSS would depend on it with the floats. Also just set the ul to list-style:none in the CSS and added the rel tags to the test.

Status: Needs review » Needs work

The last submitted patch, booknavigation_v2.patch, failed testing.

mortendk’s picture

okay looks like i kinda tried to hijack this issue over at the css cleanup
So i wanted som thoughts on changing the markup for the navigation to use li so we end up with the same markup & classes as the pager.

book-navigation.tpl:

<?php if ($tree || $has_links): ?>
  <div class="book-navigation">
    <?php print $tree; ?>

    <?php if ($has_links): ?>
    <ul class="pager clearfix">
      <h2 class="element-invisible"><?php print t('Book Navigation'); ?></h2>    
      <?php if ($prev_url): ?>
        <li class="page-previous"><a href="<?php print $prev_url; ?>" rel="next" title="<?php print t('Go to previous page'); ?>"><?php print t('‹ ') . $prev_title; ?></a></li>
      <?php endif; ?>
      <?php if ($parent_url): ?>
        <li class="page-up"><a href="<?php print $parent_url; ?>" title="<?php print t('Go to parent page'); ?>"><?php print t('up'); ?></a></li>
      <?php endif; ?>
      <?php if ($next_url): ?>
        <li class="page-next"><a href="<?php print $next_url; ?>" rel="prev" title="<?php print t('Go to next page'); ?>"><?php print $next_title . t(' ›'); ?></a></li>
      <?php endif; ?>
    </ul>
    <?php endif; ?>

  </div>
<?php endif; ?>

changes in the book.theme.css.

.book-navigation .pager {
  border-bottom: 1px solid #888;
  border-top: 1px solid #888;
  list-style-type: none;
  padding: 0.5em;
  text-align: center;
}

im gonna roll a patch later today - but thought it was worth a discussion ;)

mgifford’s picture

Looks good to me..

mortendk’s picture

Assigned: Unassigned » mortendk
Status: Needs work » Needs review
FileSize
8.1 KB

I have marked a #1216970: Clean up the CSS for Book module duplicate and rolled the patch together with the one here with an added nav love

Jacine’s picture

Status: Needs review » Needs work

Ok, so the markup is good and the tests pass! Yay!

The CSS tests well (even in IE7) but there are code style some issues:

+++ b/core/modules/book/book.theme.cssundefined
@@ -0,0 +1,42 @@
+.book-navigation .menu {
+  border-top: 1px solid #D6D6D6;
+  padding: 1em 0 0 3em; /* LTR */
+}
+
+

There shouldn't be any empty lines after this.

+++ b/core/modules/book/book.theme.cssundefined
@@ -0,0 +1,42 @@
+  margin:0;

There needs to be a space after the colon, before the value.

+++ b/core/modules/book/book.theme.cssundefined
@@ -0,0 +1,42 @@
+
+.pager li{

The empty line above the rule needs to go and there should be a space after li and before the opening bracket.

+++ b/core/modules/book/book.theme.cssundefined
@@ -0,0 +1,42 @@
+  float:left;

There needs to be a space after the colon, before the value.

Now... this .pager style stuff. What is the deal? It seems like you're trying to make this a globalized style, because you prefixed these selectors with the .pager class, but what happens when you've got both the book CSS and the system.theme.css CSS on the same page, and you've customized the pager styles? A conflict on .pager li is gonna happen for sure...

Looking at this deeper, the class names on the list items don't use the same naming conventions. If we were trying to do that, then it'd be: pager-next, pager-previous and pager-up instead of page-next, page-previous and page-up.

I don't know. Honestly, I don't think the pager class here is a good idea. This requires all all sorts of floating and different presentation, whereas the regular pager could just use display: inline, and I am worried about this getting messed up and being annoying when a theme does heavy styling for the regular pagers. At the end of the day the only thing they actually share is list-style-type: none, so it doesn't really seem worth it.

What's the benefit do you see from doing this?

jyve’s picture

Since the book pager is functionally different from a normal Drupal pager, I agree that a themer will end up with too much CSS overwrite issues if we use the .pager class here.

Other than the issues mentioned by Jacine, this patch looks good to me.

mortendk’s picture

Status: Needs work » Needs review
FileSize
8.31 KB

alright i hear ya - i was a little tricker happy there

Status: Needs review » Needs work

The last submitted patch, book-accessibility-css-2.patch, failed testing.

mortendk’s picture

Status: Needs work » Needs review
FileSize
8.12 KB

lets try this again...

mortendk’s picture

Title: book module now without clearfix & better markup + accessability love » and now without clearfix & better markup
FileSize
44.7 KB
22.24 KB
24.36 KB
20.93 KB
8.95 KB

Even that the book module is now ready to go - i kinda I played around further with the book navigation module, now that we opened up the box so i changed a couple of things to make it even better.
The < & > is wrapped in a b tags, so we can do stuff add icons whatever to the arrows, or remove em directly with a display none etc. - This gives us way more flexibility, than we got today

Changed the css a little so we can remove the .clearfix class *yeah*

the css is marked with the fixes for ie7 + commented quite heavy & the book.test needs an update.

I have added a couple of screenshots for different browsers & RTL lang as well (only the ie's ;)

mortendk’s picture

Title: Book Module Navigation links need better context for accessibility » book module now without clearfix & better markup + accessability love
Status: Needs review » Needs work

changes the title

mortendk’s picture

Title: and now without clearfix & better markup » book module now without clearfix & better markup + accessability love
Status: Needs work » Needs review
FileSize
9.07 KB

can anyone tell me why the › is inside a t( ) ?
is there any reason for that other than old legacy it was then easy to change in the t function instead of using the tpl file ?

Xen’s picture

@mortendk
It allows you to translate › to ‹ for rtl languages perhaps?

Status: Needs review » Needs work

The last submitted patch, book-dieclearfix-rtl.patch, failed testing.

mortendk’s picture

Status: Needs work » Needs review
FileSize
8.85 KB
droplet’s picture

Status: Needs review » Needs work
+++ b/core/modules/book/book.theme-rtl.cssundefined
@@ -0,0 +1,22 @@
+.book-navigation .page-up {
+  *float: right; /*IE7*/ ¶
+}

+++ b/core/modules/book/book.theme.cssundefined
@@ -0,0 +1,47 @@
+  *zoom: 1;  /* IE7 */
+  *display: inline;	/* IE7 */
+  *float:left; /* IE7 we need this so we dont end up having a obscure breakline when floating right on page-next */
...
+  *display: inline;	/* IE7 */ ¶
...
+  *zoom: 1;/* IE7 */ ¶

move to ie.css ??

20 days to next Drupal core point release.

mortendk’s picture

guess we should have an ie7.css file - but isnt that a thing for the whole of core, so we can collect the garbage one place ?
or should we place them as module.ie7.css thats offcourse starting a whole new amount of css files to be loaded
the reason the comments is so we can find em again in x months when its decided to kill ie7 support (as im expecting ;))

droplet’s picture

Status: Needs work » Needs review
FileSize
8.25 KB

I clean up some codes.

removed b tag and move into t(), although this is a title but I think some guy want to change it to other format :)

any reason when not use the standard .clearfix ??

+.page-links li {
+  display: inline-block; 
+  list-style-type: none; 
+  letter-spacing: normal; /*fix the letter spacing -4px from the parent*/
+  *zoom: 1;  /* IE7 */
+  *display: inline;	/* IE7 */
+  *float:left; /* IE7 we need this so we dont end up having a obscure breakline when floating right on page-next */
+}

when we use display: inline-block, space between left & right is different.

+ letter-spacing: -4px;
This is no sense to me, I don't really get it :(

Status: Needs review » Needs work

The last submitted patch, book-clean-up.patch, failed testing.

mortendk’s picture

Status: Needs review » Needs work

Thats not cleaning up - thats removing the functionality.

Youre missing the point with the b tags, and the flexibility in the layout it gives us,as an exampla i added a little bit of margin on the links to make it easier on the eyes (and not with a space as its done today) - Without the b (could as well be spans etc) theres no way to control the < + > the spacing, padding margin borders background etc on these 2 "arrows" - it needs a wrapper.
The reason for the b is that is small and easy to read in the css now a designer can by changing the css do what he wants with the pager "arrows", a good side effect is that they have a little bit of heigher weight (bold) than normally which make em naturally stand out.

The whole idea here is that we dont need the clearfix. Clearfix is a nessesary evil. A trick where we try to force a block to wrap around blocks inside it. Spreading it around the drupal core by hardcoding it as a class on every element, is making our codebase it less flexible for the frontend developers (core has now about 100 places where the clearfix is thrown in) - more about the evilness of clearfix : http://thinkvitamin.com/design/everything-you-know-about-clearfix-is-wrong/
We cant align elements with clearfix up next to eachother. When theres ways to get around this by using clean css, we should indeed use it.
The hardcoded clearfix, is a pain to owerwrite, and is frankly a little like putting everything in tabels cells "because that works"

By using the inline-block we can set a width of an element, but its still floating naturally, which a block elements dosnt do unless you float it left & we can now position the books navigation as we want to & dont end up in wrapping that in another div just to remove the clearfix.

The letter spacing at -4 px is to remove the spacing the display: inline-block gives around every li element (we can use font-size:0 instad) its set on the ul (in this case the .page-links) its then cancelled on the li elements , and it all keeps its natural behaviour.

Now the links align up as we would have with a display:block float:left, but we dont have to wrap it in an clearfix that remove our posibility to align the navigation with whatever we might wants

voila everybody wins :)

The reason for the ie7 fixes are placed like that in the code is so we can find em again quickly by searching for /* IE7 */

btw "when we use display: inline-block, space between left & right is different." you have a screenshot + browser so i can check that ?

mortendk’s picture

Status: Needs work » Needs review
FileSize
30.34 KB
24.36 KB
44.75 KB
27.46 KB
20.93 KB
22.59 KB
66.99 KB
44.7 KB
28.63 KB
22.24 KB
41.23 KB
51.58 KB
20.65 KB
43.43 KB
30.48 KB
23.04 KB
43.73 KB
20.78 KB
22.46 KB
45.85 KB
16.22 KB
18.58 KB
42.36 KB
8.93 KB

I have just tested the code on almost all the browsers I have, I dont have a *nix though :(
but heres the screenshots for the test on verious browsers from ie7 to opera + in stark & Bartik.

Theres a minor problem with the supixel rendering using % so theres 1% missing in the calculation (and not the 8% that are missing from core in d7) i think thats actually acceptable & is very easy fixed by a theme it it wants absolute widths, then its easy overwritten.

droplet’s picture

Status: Needs work » Needs review
FileSize
78.35 KB
+++ b/core/modules/book/book.theme.cssundefined
@@ -0,0 +1,47 @@
+  letter-spacing: -4px; /* inline block 4px letter spacing, they are removed here but added again to the li */

why -4px and not -3px or other vaule. when happen if we remove it.

+++ b/core/modules/book/book-navigation.tpl.phpundefined
@@ -30,22 +29,27 @@
+          <a href="<?php print $prev_url; ?>" rel="prev" title="<?php print t('Go to previous page'); ?>"><b><?php print t('‹'); ?></b><?php print $prev_title; ?></a>
...
+          <a href="<?php print $next_url; ?>" rel="next" title="<?php print t('Go to next page'); ?>"><?php print  $next_title;?><b><?php print t('›'); ?></b></a>

wrap inside t function is better ?

and trailing space problem in the patch. (also double space: print $next_title)

19 days to next Drupal core point release.

mortendk’s picture

FileSize
8.83 KB
44.33 KB
52.03 KB
124.04 KB

The reason for -4px is thats is the value added by default by the block-inline which is a PITA , but thats just how it is (and make sense when its inside a p etc.)
In this case though after som playing around -3px was actually working better with the subpixel renedering, cause by the % - So the centering of the up link, after an adjustment of the width to 9.8% was almost perfect, with the exception of Opera 11.52 which IMHO is ok.

mortendk’s picture

Status: Needs review » Needs work
FileSize
8.83 KB

stupid whitespace

aspilicious’s picture

+++ b/core/modules/book/book.theme.cssundefined
@@ -0,0 +1,47 @@
+  letter-spacing: -3px; /* -3px instead of -4 to push it the last pixel to better centeren of the up link */

This sentence is kinda weird although I understand it

+++ b/core/modules/book/book.theme.cssundefined
@@ -0,0 +1,47 @@
+  width:9.8%; /* subpixel fun */

Lol I'm not sure this accepted as a comment

So if this approach gets accepted it only need "better" docs in the css file and than this is done.

19 days to next Drupal core point release.

aspilicious’s picture

Status: Needs work » Needs review

Needs review :)

mortendk’s picture

FileSize
8.87 KB

now better & more documentation

moshe weitzman’s picture

Welcome to core development, Morton. Trial by fire is the only way!

Is there a particular reason we are naming the new file book.theme.css and not just book.css? CSS files always have to do with themeing as they are about presentation. Seems wordy for no benefit.

aspilicious’s picture

moshe you should read: http://drupal.org/node/1089868

droplet’s picture

+++ b/core/modules/book/book-navigation.tpl.phpundefined
@@ -30,22 +29,27 @@
+          <a href="<?php print $prev_url; ?>" rel="prev" title="<?php print t('Go to previous page'); ?>"><b><?php print t('‹'); ?></b><?php print $prev_title; ?></a>

I would recommend wrap all links text inside a t function. but if you are don't like it, this is a better one I think, Instead hardcoding the B tag: print t('<b>‹</b>');

+++ b/core/modules/book/book.theme.cssundefined
@@ -0,0 +1,48 @@
+   padding: 1em 0 0 3em; /* LTR */

other UL has 2.5em, may keep it same to other ??

#94 try to remove all padding value here:

+++ b/core/modules/book/book.theme.cssundefined
@@ -0,0 +1,35 @@
+ .book-navigation {
+  border-bottom: 1px solid #D6D6D6;
+  border-top: 1px solid #D6D6D6;
+ }
+.book-navigation .page-links {
+  border-top: 1px solid #D6D6D6;
+  margin: 0;
+  padding: 0.5em 0;
+  overflow: auto;
+}

letter-space is hacking css bug, but by remove it the page is still working well. I seen no reason to keep it

18 days to next Drupal core point release.

mortendk’s picture

@droplet:
Markup in a translations ... That is not the way to do it - then we suddenly have markup that changes based on a translation, talk about debuggin hell ;)
so that is a what i consider a no-go.
Markup lives in eater the theme layer or in a theme function -else were ending with total confusion. Unless i really misunderstood something ??

The letterspacing "trick" is not a css bug - it works as designed - were just using it in another than the css fathers intended (and until the flexi box comes)

At this point there isnt any guidelines of margin & paddings in core . seems like "someone" have set some way back in time.
I would suggest that we dont take that task here but opens up a seperate bug about generalising all margin & paddings in drupal.

but there might be a point in no having lines etc, even that its kinda seen as a drupal default, since the dawn of book module

@moshe yeah i finally made it in ! ... fire ill give you fire ;)
its all about the BAT filings, so the css is gonna be seprated n stuff ;)

droplet’s picture

-1 for RBTC (reason: #106)

unless somebody tell me there SHOULD be another issue for clean up book module, otherwise I think it worth to clean up the padding/margins here.

sorry about it. willing to see other's opinion :)

jyve’s picture

FileSize
8.82 KB

I don't want to steal your patch here @mortendk, but there were so many small remarks that creating a new patch was easier than listing them all.

This was done in the new patch:
- removed an extra white line at the end of book.theme.css
- removed an extra white space in front of every line in book.theme.css
- added some missing spaces between properties and their values
- alphabetized all properties since this wasn't always the case
- agree with @droplet to change the left padding on the menu to 2.5em since that seems to be the standard on all other li's in Drupal core
- updated the comments a bit more
- tested if we can remove the letter-spacing mentioned by @droplet, but doing so breaks the layout so this 'hack' needs to stay in unfortunately
- totally agree with mortendk that the markup should be left outside of the translation system.

One remark that I did not put in the patch, is that maybe something like ' is better than using the 'b' tag in the links in book-navigation.tpl.php?

mortendk’s picture

yeah some crap happend with the last patch, dont patch in an airport with screaming kids - i saw it after takeoff - fixed it and was about to submit it, when i saw you patch ;) ooh well that can teach me not to cross borders on a friday night.

yup the letter spacing is the only way to remove that spacing from the inline-block. But removes the clearfix which is an actual hack & in this situation it dosnt matter because of the ul li combination where its the only place its added - and please stop call it a hack when it isnt ;)

the 2.5 em is a good catch think the 3em was something that have been floating around since the dawn of the book module (im stille wondering where those 2.5ems and others are coming from and why they were decided upon)

So what you mean with "One remark that I did not put in the patch, is that maybe something like ' is better than using the 'b' tag in the links in book-navigation.tpl.php?" - you wanna look at something like a span with a loong class name etc in or ?

jyve’s picture

Yeah, I was thinking a bit more about it overnight, and we should leave the 'b' tag as is :)

Everett Zufelt’s picture

Curious where $prev_title and $next_title are defined and what their contents are.

+          <a href="<?php print $parent_url; ?>" title="<?php print t('Go to parent page'); ?>"><?php print t('up'); ?></a>

I don't know that 'up' really says very much about the purpose of this link.

droplet’s picture

FileSize
42.38 KB

@jyvs,
last patches changed .page-up width to 9.8%, so removes letter space doesn't apply anymore. it should be leave there now.

needs move it up ?
up
vertical-align: top;

and why not totally remove the paddings (use default/ pre-defined /drupal reset style):

OLD:

.book-navigation .menu {
  border-top: 1px solid #D6D6D6;
  padding: 1em 0 0 2.5em; /* LTR */
}
.book-navigation .page-links {
  border-bottom: 1px solid #D6D6D6;
  border-top: 1px solid #D6D6D6;
  letter-spacing: -3px; /* removes unwanted white space added by inline-block */
  margin: 0;
  overflow: auto;
  padding: 0.5em 0;
}

NEW:

.book-navigation {
  border-bottom: 1px solid #D6D6D6;
  border-top: 1px solid #D6D6D6;
}
.book-navigation .page-links {
  border-top: 1px solid #D6D6D6;
  letter-spacing: -3px; /* removes unwanted white space added by inline-block */
  overflow: auto;
  margin: 0;
  padding: 0.5em 0;
}
aspilicious’s picture

I didn not test it but do we have to duplicate border-top?

.book-navigation {
  border-bottom: 1px solid #D6D6D6;
  border-top: 1px solid #D6D6D6;
}
.book-navigation .page-links {
  border-top: 1px solid #D6D6D6;
mgifford’s picture

@Everett template_preprocess_book_navigation() defines previous/next content and they include the title of the adjoining pages.

Now Up isn't very descriptive, but it's a rather tight space to put two titles in a footer let alone three. In the example uploaded by @droplet I wonder if it might not be a good idea to trip the length of the title to say say 50 characters.

Does the extra padding make it easier to click on the Up link? I'm trying to figure out why it is there. Spacing from the other two?

webchick’s picture

Title: book module now without clearfix & better markup + accessability love » book module now without clearfix & better markup + accessibility love

Sorry, that's been driving me nuts. ;)

jyve’s picture

FileSize
8.78 KB

@droplet in #113:

- Even with the 9.8% width on the 'up', we still need to have the letter-spacing fix, tested in Chrome and Firefox.
- In which browser did you take the screenshot on the vertical-align proposal? I tested this in Chrome and Firefox, and don't have that issue, everything is aligned at the top here. Also, I don't think the vertical-align would help in this case.
- if we remove the padding altogether, and update the borders as you proposed, then we get a double border above the book pager when there is no menu above it. I have however changed the padding by only applying a top and bottom one, so that we at least inherit the left and right ones.

@mgifford in #115:
- what padding on the 'up' are you referring too? There's no padding on that element for the moment.
- Trimming the length might indeed be an option, but I would love some more opinions on this before we implement that.

mortendk’s picture

FileSize
9.39 KB

fixed the problem with very long titles & top align the text.
added a badass little up arrorw to the up - to keep with the < >
moved the border colors over to bartik.css where they belong
tested in all browser i could possibly find.

i dont think theres more that can be done on this one now ;)

droplet’s picture

@#117 jyve,

- In which browser did you take the screenshot on the vertical-align proposal? I tested this in Chrome and Firefox, and don't have that issue, everything is aligned at the top here. Also, I don't think the vertical-align would help in this case.

Apply your patch #114, and browsers support inline-block have this problem, technically this issue always happen on display:inline-block
(http://blog.mozilla.com/webdev/2009/02/20/cross-browser-inline-block/)

- if we remove the padding altogether, and update the borders as you proposed, then we get a double border above the book pager when there is no menu above it. I have however changed the padding by only applying a top and bottom one, so that we at least inherit the left and right ones.

Nice, never thought it before. But by default installation, how to remove menu (.book-navigation ul.menu)? and any chance to remove book pager/nav (.book-navigation ul.page-links) ??

Status: Needs review » Needs work

The last submitted patch, book.patch, failed testing.

mortendk’s picture

fixes for vertical alignment top
border moved to bartik

mortendk’s picture

okay so if we have a pre & next arrow - how come that there isnt a up arrow?
the patch is a build on top of #121

screenshot is attached - or should this end up in another issue ?

i have added the add an up arrow as an seperate issue #1340242: add an arrow for the book up

aspilicious’s picture

Status: Needs work » Needs review

I think the up arrow is weird but anyway thats a seperate issue IMO.

mortendk’s picture

FileSize
8.96 KB

* cleaned up and removed the "pixel perfect" fixes, ts overkill for stark & were not winning that much by those x pixels. pixel perfect is for the ebd theme and not core + makes it easier to maintain
* changed the classe namer for the page-links to the module specific book-pager
* removed the up arrow (cause thats for another patch & discussion)

mortendk’s picture

FileSize
8.94 KB

and without the pink test color *doh*

Jacine’s picture

Status: Needs review » Needs work

Nice work @mortendk! This is looking good. A couple of minor issues to fix before this is ready.

+++ b/core/modules/book/book-navigation.tpl.phpundefined
@@ -30,22 +29,27 @@
+          <a href="<?php print $prev_url; ?>" rel="prev" title="<?php print t('Go to previous page'); ?>"><b><?php print t('‹'); ?></b><?php print $prev_title; ?></a>

We need an empty space between the title and the b tags. The arrow is on top of the text and hard to see.

+++ b/core/modules/book/book.theme.cssundefined
@@ -0,0 +1,40 @@
+  *float:left; /* in ie7 the .page-next float:right adds a line break - unless it has float:left */

There needs to be a space after the colon, and the comment needs work. We should move the comment to the line above the code, and also include a LTR comment inline. So, like this:

  /* Prevents a line break caused by the float in .page-next in IE7. */
  *float: left; /* LTR */
+++ b/core/modules/book/book.theme.cssundefined
@@ -0,0 +1,40 @@
+  *zoom: 1;

Let's loose the * before the zoom property. We don't use that anywhere else in core.

+++ b/core/modules/book/book.theme.cssundefined
@@ -0,0 +1,40 @@
+  text-align: left;

This needs a /* LTR */ comment.

+++ b/core/modules/book/book.theme.cssundefined
@@ -0,0 +1,40 @@
+  text-align: right;
+  float: right;

Both of these need a LTR comment.

+++ b/core/themes/bartik/css/style.cssundefined
@@ -1648,3 +1648,13 @@ div.admin-panel .description {
+.book-navigation .page-links {

This should be .book-navigation .book-pager, or just .book-pager.

16 days to next Drupal core point release.

droplet’s picture

+++ b/core/themes/bartik/css/style.cssundefined
@@ -1648,3 +1648,13 @@ div.admin-panel .description {
+/* ---------- book ----------- */

and the comment format

16 days to next Drupal core point release.

mortendk’s picture

Status: Needs work » Needs review
FileSize
8.92 KB

here we go with another one :
* cleaned up the class names even more to be easier & quicker to read
* moved the specifics for bartik (the book-navigation .book-pager ul's margin:0 that need an overwrite now that bartik sets that as default)
* added the space between the b and link - even that i think this should be done with css & not a space - but i wont fight over it ;)
* fixed the comments for RTL
* testet in ie6-9, latest: opera,safari, chrome & ff

yoroy’s picture

/me just cheerleads in here for a bit. Go team!

jyve’s picture

Status: Needs review » Needs work

Tested the patch in #128:

- There's one white line too much here:

+/**
+ * Book navigation.
+ */
+
+.book-navigation .menu {

- Is there a reason why the width of the up link has been reduced to 4? The positioning is still ok for me when it is at 9% unless this causes issues in other browsers than Firefox/Chrome?

.book-pager .up {
  text-align: center;
  width: 4%;
}

- This needs to be alphabetical:

.book-pager .next {
  text-align: right; /* LTR */
  float: right; /* LTR */
  width: 45%;
}

Looking good otherwise!

mortendk’s picture

Status: Needs work » Needs review
FileSize
8.92 KB

its changed to 8% now, we had funny jumps with resizing to small screensizes

mgifford’s picture

@jyve I was mostly just looking at the image in #113.

I think I saw that and just assumed it was demonstrating something like padding: 5px 5px; as per articles like:

http://www.smashingmagazine.com/2010/02/13/the-definitive-guide-to-styli...
http://ezinearticles.com/?Website-Usability-and-Accessibility-Tips&id=43...

Should have looked at the code more carefully.

Agreed that the trim length tool would be better as an option.

jyve’s picture

Patch in #131 reviewed and looks perfect to me now.

@droplet in #127: I suggest we open up a new issue to update all comments in Bartik since they don't follow the Drupal CSS conventions.

@mgifford in #132: I'm actually not really pro cutting the length anymore, unless we can make it a setting in the backend, but it feels like overkill? Any other opinions on this?

mgifford’s picture

@jyve - I'm not fixed on shortening the titles. I suppose it can be easily over-ridden in a theme if required.

Jacine’s picture

Status: Needs review » Reviewed & tested by the community

I think this is ready now. Lucky 135? :P

catch’s picture

Status: Reviewed & tested by the community » Fixed

This looks like good cleanup. Committed/pushed to 8.x! Nice to see new people patching core in here as well.

Status: Fixed » Closed (fixed)
Issue tags: -Accessibility, -markup, -html5, -semantics

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