 		rect = @__layer.DOM.rect()
 		@__minimumElementWidthUsed = false
 
-		minimum_width = 0
+		# let's see if we need to put a minimum size
 		if @_use_element_width_as_min_width and @__element
 			dim = DOM.getDimensions(@__element[0])
-			minimum_width = dim.borderBoxWidth
+			if dim.borderBoxWidth >= rect.width
+				@__minimumElementWidthUsed = true
+				width = dim.borderBoxWidth
+			else
+				width = rect.width
+			# console.error "Layer.__getLayoutDim: Set min-width on layer:", rect.width, dim.borderBoxWidth
+		else
+			width = rect.width
 
 		@__layer.removeClass("cui-layer-measure")
 


		@__setLayerSizeFromFixedDimensions()

#REMARKED 'horizontal scrollbar' not reproducable
#		# lets check if we can get rid of a very short
#		# horizontal scrollbar
#		if @__minimumElementWidthUsed
#			layer_dim = DOM.getDimensions(@__layer.DOM[0])
#			if layer_dim.verticalScrollbarWidth > 0
#				# add width
#				@__layer.DOM.width(@__fixed_layer_dim._css_width + layer_dim.verticalScrollbarWidth)

		@_onPosition?(@)
		@

		# if our axis wants to be filled then we don't use its fixed size

		if isUndef(@__fixed_layer_dim) or @_fill_space in ["both","horizontal"]
			@__layer_dim.width = width + @__layer_margin.left + @__layer_margin.right
			@__layer_dim._css_width = rect.width - @__layer.DOM.cssEdgeSpace("horizontal")
		else
			@__layer_dim.width = @__fixed_layer_dim.width
			@__layer_dim._css_width = @__fixed_layer_dim._css_width
