Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.6.0] Hint blocks are help blocks #131

Closed
Commifreak opened this issue Oct 19, 2021 · 6 comments
Closed

[1.6.0] Hint blocks are help blocks #131

Commifreak opened this issue Oct 19, 2021 · 6 comments

Comments

@Commifreak
Copy link

Commifreak commented Oct 19, 2021

} elseif ($bsVer === 3) {

Are you sure that this is correct? We just updated yii2-widget-activeform and under an BS3 env (which uses div and classhint-block as default) all changed into p with help-block.

@kartik-v
Copy link
Owner

The help-block class is the Bootstrap 3 CSS default - as implemented in yii2-bootstrap base extension build as seen here.

However, will add the enhancement to get a standard hint-block class across BS versions.

@kartik-v kartik-v reopened this Oct 19, 2021
@Commifreak
Copy link
Author

Commifreak commented Oct 19, 2021

I see - In the meantime, we figured out, that the default tag is p - from BS. But Yii defaults to div with hint-block (https://www.yiiframework.com/doc/api/2.0/yii-widgets-activefield#$hintOptions-detail), so you use BS standard while Yii uses a different way. That breaks some usages in my eyes, without set fieldConfig->hintOptions now.

Another thing: since 1.6.0, the template changed to {error}{hint} while is was always {hint}{error} (for Horizontal). Is this intended behaviour?

@kartik-v
Copy link
Owner

Another thing: since 1.6.0, the template changed to {error}{hint} while is was always {hint}{error} (for Horizontal). Is this intended behaviour?

Yes this is an intended behavior to maintain consistency across Bootstrap versions - the error block has to be immediately after the input for CSS styles to work as intended in bootstrap 4.x and 5.x markups.

@Commifreak
Copy link
Author

Commifreak commented Oct 19, 2021

Its even weirder.

yii\widgets\ActiveForm uses yii\widgets\ActiveField => <div class="hint-block">
yii\bootstrap\ActiveForm uses yii\bootstrap\ActiveField => <p class="help-block">

And your ActiveForm extends the 1st (widget). The latest changes from 1.6.0 uses the createLayoutConfig with the defaults from bootstrap (p tag) and therefore overrides it.

So (correct me if Iam wrong) all your ActiveForm users (before 1.6.0) had a div tag and now its a p tag, if they're using hints. That seem to be a change, that should be announced, right?

@kartik-v
Copy link
Owner

kartik-v commented Oct 19, 2021

These have been fixed with the latest commit f49b8b9.

@Commifreak
Copy link
Author

Yep, just seen that.

Took us a few minutes to understand whats going on, but now it seems clear. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants