X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/ff159a4d47b9a2d10744dcfc23da2c63605c8a32..eeb5375ee7727c956cc357cc8f90b19d1bfe80b9:/SL/Presenter/MaterialComponents.pm diff --git a/SL/Presenter/MaterialComponents.pm b/SL/Presenter/MaterialComponents.pm index 30123b719..d0ddfc483 100644 --- a/SL/Presenter/MaterialComponents.pm +++ b/SL/Presenter/MaterialComponents.pm @@ -13,6 +13,7 @@ use Exporter qw(import); our @EXPORT_OK = qw( button_tag input_tag + textarea_tag date_tag submit_tag icon @@ -231,6 +232,28 @@ sub input_tag { ); } +sub textarea_tag { + my ($name, $value, %attributes) = @_; + + _set_id_attribute(\%attributes, $attributes{name}); + + my $class = delete $attributes{class}; + my $icon = $attributes{icon} + ? icon(delete $attributes{icon}, class => 'prefix') + : ''; + + my $label = $attributes{label} + ? html_tag('label', delete $attributes{label}, for => $attributes{id}) + : ''; + + html_tag('div', + $icon . + html_tag('textarea', $value, class => 'materialize-textarea', %attributes, name => $name) . + $label, + class => [ grep $_, $class, INPUT_FIELD ], + ); +} + sub date_tag { my ($name, $value, %attributes) = @_; @@ -280,10 +303,11 @@ sub select_tag { : ''; my $label = $attributes{label} - ? html_tag('label', delete $attributes{label}, for => $attributes{id}) + ? html_tag('label', delete $attributes{label}, for => $attributes{id}, class => 'active') : ''; - my $select_html = SL::Presenter::Tag::select_tag($name, $collection, %attributes); + my $select_html = SL::Presenter::Tag::select_tag($name, $collection, %attributes, + class => 'browser-default'); html_tag('div', $icon . $select_html . $label, @@ -343,9 +367,20 @@ directly as classes. =back -=head1 BUGS +=head1 BUGS & ISSUES + +There is a bug in MaterializeCSS, when using a Materialize select element on an iphone, +the wrong element is selected. This is currently worked around in the presenter by using +the 'browser-default' class on the select element as well as the 'active' class on the +label (to prevent the label from overlapping the select element). +This should be fixed, upstream, in MaterializeCSS. However it seems that the project is +not maintained anymore (according to github issues[^1]). There is a community fork[^2], +which it's still maintained and where the problem seems to be fixed already. It is currently +in alpha V. 2.0.3-alpha. Maybe it would be good to consider switching to that fork at some +point. -Nothing here yet. +[1]: e.g. https://github.com/Dogfalo/materialize/issues/6688 +[2]: https://github.com/materializecss/materialize =head1 AUTHOR