HomeThe BikeshedComponents

scrollable.html

Published:

Not much here, just making divs scrollable. Make sure to add a label, you need it. In that case, it also means that all my code blocks probably need labels as well…

Source Code

{{- if and (.Get "aria-labelledby") (.Get "aria-label") -}}
    {{ errorf "Error in %s: aria-label and aria-labelledby are mutually exclusive in scrollable shortcode." page.File.Filename }}
{{- end -}}
{{- if not (or (.Get "aria-labelledby") (.Get "aria-label"))  -}}
    {{ errorf " %s: scrollable shortcode must have either an accessible name through aria-label or aria-labelledby." page.File.Filename }}
{{- end -}}
{{- if or (in $.Params "region") (in $.Params "tabindex") -}}
    {{ errorf " %s: region and tabindex in scrollable shortcode can't be overridden" page.File.Filename }}
{{- end -}}
{{ .Inner }}

Also uses this css

.scrollable {
    overflow: auto;
}