}
if ( isset( $this->mSubmitTooltip ) ) {
- $attribs += Linker::tooltipAndAccesskeyAttribs( $this->mSubmitTooltip );
+ $attribs += [
+ 'title' => Linker::titleAttrib( $this->mSubmitTooltip ),
+ 'accessKey' => Linker::accesskey( $this->mSubmitTooltip ),
+ ];
}
$attribs['classes'] = [ 'mw-htmlform-submit' ];
* @return string HTML
*/
protected function formatSection( array $fieldsHtml, $sectionName, $anyFieldHasLabel ) {
+ if ( !$fieldsHtml ) {
+ // Do not generate any wrappers for empty sections. Sections may be empty if they only have
+ // subsections, but no fields. A legend will still be added in wrapFieldSetSection().
+ return '';
+ }
+
$config = [
'items' => $fieldsHtml,
];
if ( $sectionName ) {
- $config['id'] = Sanitizer::escapeId( $sectionName );
+ $config['id'] = Sanitizer::escapeIdForAttribute( $sectionName );
}
if ( is_string( $this->mWrapperLegend ) ) {
$config['label'] = $this->mWrapperLegend;