-
Notifications
You must be signed in to change notification settings - Fork 17
HeadingLevel
HeadingLevel is an enum used by a number of components which output HTML heading elements.
The HeadingLevel determines the type of heading element output:
- HeadingLevel.H1 will output a h1 element;
- HeadingLevel.H2 will output a h2 element;
- HeadingLevel.H3 will output a h3 element;
- HeadingLevel.H4 will output a h4 element;
- HeadingLevel.H5 will output a h5 element;
- HeadingLevel.H6 will output a h6 element;
Headings must be sequential within a piece of sectioning content. Try this: 4.3.11 Headings and sections.
A HeadingLevel applied to a WHeading is a heading for all subsequent content until either the next heading (WHeading or WCollapsible with HeadingLevel set) of the same or greater HeadingLevel or the next start of sectioning content.
Similarly, a HeadingLevel applied to a WCollapsible is a heading for that WCollapsible's content and any subsequent content until either the next heading (WHeading or WCollapsible with HeadingLevel set) of the same or greater HeadingLevel or the next start of sectioning content.
For example within any section a WHeading of HeadingLevel.H3 (equivalent to h3) must be within the content scope of a WHeading or WCollapsible of HeadingLevel.H2 (h2) and any WHeading subordinate to a WHeading of HeadingLevel.H2 (h2) must be a WHeading of HeadingLevel.H3 (h3).
It may help to consider each heading and its non-heading content as part of a tree and the heading should be appropriate for the nesting level. The occurrence of a new section within the "tree" starts a new tree at that section.
The components which create sections within a WComponents application are:
- WApplication
-
WPanel of type
ACTION
; -
WPanel of type
CHROME
; - WSection; and
- WDialog.
WPanel of type ACTION
, WPanel of type CHROME
, WSection and WDialog each contain a heading which is a h1
element. The top level heading within the component's content should, therefore, have HeadingLevel.H2.
WApplication should also contain either a WHeading of HeadingLevel.H1 which is not nested within another section; or another sectioning component with a heading (such as WSection). In effect this means that only a WPanel of type HEADER
should ever contain a WHeading of HeadingLevel.H1 since this is normally the first content container within a WApplication.