laravel-debugbar
laravel-debugbar copied to clipboard
Debugbar adding a 8px margin-bottom on <body> when enabled
Steps to reproduce:
- Activate Debugbar
- Open any page in your project
- Open Devtools and you should see the margin-bottom appended on tag
Please let me know if it is actually needed for the bar to work or if I am doing something wrong with some setting.
Thank you!
@devsquad-victor-lima
This is from the parent project PHP Debug Bar
https://github.com/maximebf/php-debugbar/blob/1c2a5300cc1f99ef60dc17449a20e0b345d564f5/src/DebugBar/Resources/debugbar.js#L850
/**
* Recomputes the margin-bottom css property of the body so
* that the debug bar never hides any content
*/
recomputeBottomOffset: function() {
if (this.options.bodyMarginBottom) {
if (this.isClosed()) {
return $('body').css('margin-bottom', this.options.bodyMarginBottomHeight || '');
}
var offset = parseInt(this.$el.height()) + (this.options.bodyMarginBottomHeight || 0);
$('body').css('margin-bottom', offset);
}
},
I hate that margin. Is there a way to disable it?
@Jacobtims Doesn't look like it can be disabled. There's a bodyMarginBottom
option that is always set to to true
.
https://github.com/maximebf/php-debugbar/blob/1c2a5300cc1f99ef60dc17449a20e0b345d564f5/src/DebugBar/Resources/debugbar.js#L413
options: {
bodyMarginBottom: true,
bodyMarginBottomHeight: 0
},
You could try adding a PR to that project with an option to disable bodyMarginBottom
.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this issue is still present on the latest version of this library on supported Laravel versions, please let us know by replying to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.
Add this at the end of the body tag:
@if (config('app.debug'))
<script>
PhpDebugBar.DebugBar.prototype.recomputeBottomOffset = () => {};
</script>
@endif